Skip to content

Commit

Permalink
0.4.6 feat: added leaf_count_to_mmr_size
Browse files Browse the repository at this point in the history
  • Loading branch information
maaasyn committed Aug 27, 2024
1 parent eeb5ee2 commit df118be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
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.5"
version = "0.4.6"
edition = "2021"
license-file = "LICENSE"
description = "Complete package of multiple Accumulators with Stores and hashing functions (Hashers)"
Expand Down
4 changes: 4 additions & 0 deletions src/mmr/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ pub fn leaf_count_to_peaks_count(leaf_count: usize) -> u32 {
count_ones(leaf_count) as u32
}

pub fn leaf_count_to_mmr_size(leaf_count: usize) -> usize {
2 * leaf_count - leaf_count_to_peaks_count(leaf_count) as usize
}

pub fn leaf_count_to_append_no_merges(leaf_count: usize) -> usize {
count_trailing_ones(leaf_count)
}
Expand Down

0 comments on commit df118be

Please sign in to comment.