From 65152283844572add475b3f4f89a812596960067 Mon Sep 17 00:00:00 2001 From: Matt Bell Date: Fri, 18 Oct 2024 16:58:11 -0500 Subject: [PATCH] Prevent attaching children to Hash nodes in proofs --- src/proofs/tree.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/proofs/tree.rs b/src/proofs/tree.rs index 64de4c2..b161d10 100644 --- a/src/proofs/tree.rs +++ b/src/proofs/tree.rs @@ -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()?;