Skip to content

Commit

Permalink
Added some more traces related to deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
BGluth committed Feb 5, 2024
1 parent 95ea070 commit ba34a11
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/trie_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,10 @@ fn delete_intern<N: PartialTrie>(
children, nibble,
);

trace!("Branch {:x} became an extension when collapsing a branch (may be collapsed further still).
Single remaining child in slot {:x} ({}) will be pointed at with an extension node.",
nibble, child_nibble, TrieNodeType::from(non_empty_node.deref()));

// Extension may be collapsed one level above.
extension(Nibbles::from_nibble(child_nibble), non_empty_node.clone())
}
Expand Down Expand Up @@ -516,7 +520,10 @@ fn delete_intern<N: PartialTrie>(
}
Node::Leaf { nibbles, value } => {
trace!("Delete traversed Leaf (nibbles: {:?})", nibbles);
(*nibbles == curr_k).then(|| (Node::Empty.into(), value.clone()))
(*nibbles == curr_k).then(|| {
trace!("Deleting leaf ({:x})", nibbles);
(Node::Empty.into(), value.clone())
})
}
}
}
Expand All @@ -532,6 +539,12 @@ fn collapse_ext_node_if_needed<N: PartialTrie>(
ext_nibbles: &Nibbles,
child: &WrappedNode<N>,
) -> WrappedNode<N> {
trace!(
"Collapsing extension node ({:x}) with child {}...",
ext_nibbles,
TrieNodeType::from(child.deref())
);

match child.as_ref() {
Node::Branch { .. } => extension(*ext_nibbles, child.clone()),
Node::Extension {
Expand Down

0 comments on commit ba34a11

Please sign in to comment.