From 6add0dd9dcab30079d196cb788b5a32f3ab4534a Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Fri, 1 Apr 2022 08:05:41 +0200 Subject: [PATCH] Track information about hidden leaves in taproot NodeInfo --- src/util/taproot.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/util/taproot.rs b/src/util/taproot.rs index b7880402..729f6efb 100644 --- a/src/util/taproot.rs +++ b/src/util/taproot.rs @@ -549,6 +549,8 @@ pub struct NodeInfo { pub(crate) hash: sha256::Hash, /// Information about leaves inside this node. pub(crate) leaves: Vec, + /// Tracks information on hidden nodes below this node. + pub(crate) has_hidden_nodes: bool, } impl NodeInfo { @@ -557,6 +559,7 @@ impl NodeInfo { Self { hash: hash, leaves: vec![], + has_hidden_nodes: true } } @@ -566,6 +569,7 @@ impl NodeInfo { Self { hash: leaf.hash(), leaves: vec![leaf], + has_hidden_nodes: false, } } @@ -584,6 +588,7 @@ impl NodeInfo { Ok(Self { hash: sha256::Hash::from_inner(hash.into_inner()), leaves: all_leaves, + has_hidden_nodes: a.has_hidden_nodes || b.has_hidden_nodes }) } }