Skip to content

Commit

Permalink
Merge pull request #60 from HerodotusDev/develop
Browse files Browse the repository at this point in the history
v0.4.5 - Stacked MMR bug fix
  • Loading branch information
beeinger authored Aug 27, 2024
2 parents dd228bc + eeb5ee2 commit 5d51808
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "accumulators"
version = "0.4.4"
version = "0.4.5"
edition = "2021"
license-file = "LICENSE"
description = "Complete package of multiple Accumulators with Stores and hashing functions (Hashers)"
Expand Down
6 changes: 5 additions & 1 deletion src/mmr/mmrs/stacked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,12 @@ impl MMR {
_ => return table.default_get_stores_and_full_keys(sub_keys),
};

//? Sort the sub MMRs by size in ascending order
let mut sub_mmrs = table.sub_mmrs.as_ref().unwrap().clone();
sub_mmrs.sort_by(|a, b| a.size.cmp(&b.size));

let mut use_mmr: Option<SubMMR> = None;
for sub_mmr in table.sub_mmrs.as_ref().unwrap().iter() {
for sub_mmr in sub_mmrs.iter() {
if *element_index <= sub_mmr.size {
use_mmr = Some(sub_mmr.clone());
break;
Expand Down

0 comments on commit 5d51808

Please sign in to comment.