Skip to content

Commit

Permalink
Merge pull request #61 from HerodotusDev/develop
Browse files Browse the repository at this point in the history
v0.4.6 - Add leaf_count_to_mmr_size
  • Loading branch information
beeinger authored Aug 27, 2024
2 parents 5d51808 + df118be commit 34ce20c
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 34ce20c

Please sign in to comment.