Skip to content

Commit

Permalink
Prevent attaching children to Hash nodes in proofs
Browse files Browse the repository at this point in the history
  • Loading branch information
mappum committed Oct 18, 2024
1 parent 61e0018 commit 6515228
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/proofs/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ impl Tree {
));
}

if let Node::Hash(_) = self.node {
return Err(Error::Attach("Tried to attach to Hash node".into()));
}

self.height = self.height.max(child.height + 1);

let hash = child.hash()?;
Expand Down

0 comments on commit 6515228

Please sign in to comment.