Skip to content

Commit

Permalink
Bugfix: Flatten would remove the null disk addresses
Browse files Browse the repository at this point in the history
Dump was failing because it was attempting to read a zero address
  • Loading branch information
rkuris committed Nov 3, 2023
1 parent 4df2859 commit c433572
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions firewood/src/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ impl<S: ShaleStore<Node> + Send + Sync> Merkle<S> {
NodeType::Branch(n) => {
writeln!(w, "{n:?}")?;
for c in n.children {
self.dump_(c, w)?
if !c.is_null() {
self.dump_(c, w)?
}
}
}
NodeType::Leaf(n) => writeln!(w, "{n:?}").unwrap(),
Expand Down Expand Up @@ -929,7 +931,9 @@ impl<S: ShaleStore<Node> + Send + Sync> Merkle<S> {
match &u_ref.inner {
NodeType::Branch(n) => {
for c in n.children {
self.remove_tree_(c, deleted)?
if !c.is_none() {
self.remove_tree_(c, deleted)?
}
}
}
NodeType::Leaf(_) => (),
Expand Down

0 comments on commit c433572

Please sign in to comment.