Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.4.5 - Stacked MMR bug fix #60

Merged
merged 2 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading