Merkle tree panics when there's a single leaf - fix

This commit is contained in:
Sergey Vasilyev
2020-04-28 01:12:57 +03:00
committed by Pratyush Mishra
parent 4e0d92a6ec
commit 0b87c84cdd

View File

@@ -268,6 +268,10 @@ fn log2(number: usize) -> usize {
/// Returns the height of the tree, given the size of the tree.
#[inline]
fn tree_height(tree_size: usize) -> usize {
if tree_size == 1 {
return 1;
}
log2(tree_size)
}