Skip to content

Commit

Permalink
iterbuild prefix fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cheme committed May 18, 2020
1 parent 46984e1 commit 17eea1a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions trie-db/src/iter_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,19 +227,15 @@ impl<T, V> CacheAccum<T, V>
debug_assert!(self.0[last].2 == branch_d);
// encode branch
let v = self.0[last].1.take();
let nkeyix = nkey.unwrap_or((0, 0));
let nkeyix = nkey.unwrap_or((branch_d, 0));
let pr = NibbleSlice::new_offset(&key_branch, nkeyix.0);
let encoded = T::Codec::branch_node_nibbled(
pr.right_range_iter(nkeyix.1),
nkeyix.1,
self.0[last].0.as_ref().iter(), v.as_ref().map(|v| v.as_ref()));
let result = callback.process(pr.left(), encoded, is_root);
self.reset_depth(branch_d);
let ext_length = nkey.as_ref().map(|nkeyix| nkeyix.0).unwrap_or(0);
let pr = NibbleSlice::new_offset(
&key_branch,
branch_d - ext_length,
);
callback.process(pr.left(), encoded, is_root)
result
}

}
Expand Down

0 comments on commit 17eea1a

Please sign in to comment.