Skip to content

Commit

Permalink
do better
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed Oct 26, 2024
1 parent 7164683 commit 70e88b9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions crates/trie/sparse/src/trie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -674,19 +674,20 @@ impl RevealedSparseTrie {
}
}

branch_value_stack_buf.clear();
for child_path in &branch_child_buf {
branch_value_stack_buf.resize(branch_child_buf.len(), Default::default());
let mut added_children = false;
for (i, child_path) in branch_child_buf.iter().enumerate() {
if rlp_node_stack.last().map_or(false, |e| &e.0 == child_path) {
let (_, child) = rlp_node_stack.pop().unwrap();
branch_value_stack_buf.push(child);
branch_value_stack_buf[branch_child_buf.len() - i - 1] = child;
added_children = true;
} else {
debug_assert!(branch_value_stack_buf.is_empty());
debug_assert!(!added_children);
path_stack.push(path);
path_stack.extend(branch_child_buf.drain(..));
continue 'main
}
}
branch_value_stack_buf.reverse();

self.rlp_buf.clear();
let rlp_node = BranchNodeRef::new(&branch_value_stack_buf, *state_mask)
Expand Down

0 comments on commit 70e88b9

Please sign in to comment.