fix: update recalculate_from function

This commit is contained in:
Magamedrasul Ibragimov 2022-11-01 21:00:31 +03:00
parent 6b18234c66
commit 01dd08d803
2 changed files with 2 additions and 8 deletions

View File

@ -134,7 +134,7 @@ where
let mut i = key; let mut i = key;
while depth != 0 { while depth != 0 {
let value = self.hash_couple(depth, key); let value = self.hash_couple(depth, i);
i >>= 1; i >>= 1;
depth -= 1; depth -= 1;
self.db.put(Key(depth, i).into(), value.into()); self.db.put(Key(depth, i).into(), value.into());

View File

@ -59,10 +59,4 @@ impl Hasher for MyKeccak {
} }
#[test] #[test]
fn insert_delete() { fn insert_delete() {}
let mt = MerkleTree::<MemoryDB, MyKeccak>::new(3, "abacaba");
assert_eq!(mt.capacity(), 8);
assert_eq!(mt.depth(), 3);
println!("{:?}", mt.root());
}