Track information about hidden leaves in taproot NodeInfo
This commit is contained in:
parent
cb4d34fd40
commit
6add0dd9dc
|
@ -549,6 +549,8 @@ pub struct NodeInfo {
|
||||||
pub(crate) hash: sha256::Hash,
|
pub(crate) hash: sha256::Hash,
|
||||||
/// Information about leaves inside this node.
|
/// Information about leaves inside this node.
|
||||||
pub(crate) leaves: Vec<LeafInfo>,
|
pub(crate) leaves: Vec<LeafInfo>,
|
||||||
|
/// Tracks information on hidden nodes below this node.
|
||||||
|
pub(crate) has_hidden_nodes: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl NodeInfo {
|
impl NodeInfo {
|
||||||
|
@ -557,6 +559,7 @@ impl NodeInfo {
|
||||||
Self {
|
Self {
|
||||||
hash: hash,
|
hash: hash,
|
||||||
leaves: vec![],
|
leaves: vec![],
|
||||||
|
has_hidden_nodes: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -566,6 +569,7 @@ impl NodeInfo {
|
||||||
Self {
|
Self {
|
||||||
hash: leaf.hash(),
|
hash: leaf.hash(),
|
||||||
leaves: vec![leaf],
|
leaves: vec![leaf],
|
||||||
|
has_hidden_nodes: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -584,6 +588,7 @@ impl NodeInfo {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
hash: sha256::Hash::from_inner(hash.into_inner()),
|
hash: sha256::Hash::from_inner(hash.into_inner()),
|
||||||
leaves: all_leaves,
|
leaves: all_leaves,
|
||||||
|
has_hidden_nodes: a.has_hidden_nodes || b.has_hidden_nodes
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue