Add extra tests, all passing

This commit is contained in:
Paul Hauner
2019-04-25 12:00:39 +10:00
parent 58b69e9ba6
commit 827e1c62d9
3 changed files with 56 additions and 15 deletions

View File

@@ -5,7 +5,7 @@ where
T: CachedTreeHash<T> + TreeHash,
{
fn new_tree_hash_cache(&self, depth: usize) -> Result<TreeHashCache, Error> {
let mut overlay = self.tree_hash_cache_overlay(0, depth)?;
let overlay = self.tree_hash_cache_overlay(0, depth)?;
let mut cache = match T::tree_hash_type() {
TreeHashType::Basic => TreeHashCache::from_bytes(

View File

@@ -183,6 +183,7 @@ impl TreeHashCache {
.iter()
.skip(overlay_index)
.position(|o| o.depth <= depth)
.and_then(|i| Some(i + overlay_index))
.unwrap_or_else(|| self.overlays.len());
self.overlays.splice(overlay_index..end, vec![]);