Skip to content

Commit

Permalink
Track information about hidden leaves in taproot NodeInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Apr 5, 2022
1 parent cb4d34f commit 6add0dd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/util/taproot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,8 @@ pub struct NodeInfo {
pub(crate) hash: sha256::Hash,
/// Information about leaves inside this node.
pub(crate) leaves: Vec<LeafInfo>,
/// Tracks information on hidden nodes below this node.
pub(crate) has_hidden_nodes: bool,
}

impl NodeInfo {
Expand All @@ -557,6 +559,7 @@ impl NodeInfo {
Self {
hash: hash,
leaves: vec![],
has_hidden_nodes: true
}
}

Expand All @@ -566,6 +569,7 @@ impl NodeInfo {
Self {
hash: leaf.hash(),
leaves: vec![leaf],
has_hidden_nodes: false,
}
}

Expand All @@ -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
})
}
}
Expand Down

0 comments on commit 6add0dd

Please sign in to comment.