Fix compact proof decoding unaccessed last child trie. (#9715)

* fix no child proof attached but root included.

* small stress test for proof of child tries.

* rust fmt
This commit is contained in:
cheme authored and GitHub committed 2021-09-07 16:21:42 +00:00
1 parent 16144e7404
commit 0a8b3ddedc
3 files changed
+105 -1

No files matched your search

+2 -1
View File
@@ -161,8 +161,9 @@ where
}
let mut previous_extracted_child_trie = None;
let mut nodes_iter = nodes_iter.peekable();
for child_root in child_tries.into_iter() {
if previous_extracted_child_trie.is_none() {
if previous_extracted_child_trie.is_none() && nodes_iter.peek().is_some() {
let (top_root, _) =
trie_db::decode_compact_from_iter::<L, _, _, _>(db, &mut nodes_iter)?;
previous_extracted_child_trie = Some(top_root);