Prevent TapTree from hidden parts
This commit is contained in:
parent
b0f3992db1
commit
77715311cf
|
@ -143,6 +143,8 @@ impl TapTree {
|
|||
pub fn from_inner(inner: TaprootBuilder) -> Result<Self, IncompleteTapTree> {
|
||||
if !inner.is_finalized() {
|
||||
Err(IncompleteTapTree::NotFinalized(inner))
|
||||
} else if inner.has_hidden_nodes() {
|
||||
Err(IncompleteTapTree::HiddenParts(inner))
|
||||
} else {
|
||||
Ok(TapTree(inner))
|
||||
}
|
||||
|
|
|
@ -355,7 +355,7 @@ impl Deserialize for TapTree {
|
|||
builder = builder.add_leaf_with_ver(*depth, script, leaf_version)
|
||||
.map_err(|_| encode::Error::ParseFailed("Tree not in DFS order"))?;
|
||||
}
|
||||
if builder.is_finalized() {
|
||||
if builder.is_finalized() || !builder.has_hidden_nodes() {
|
||||
Ok(TapTree(builder))
|
||||
} else {
|
||||
Err(encode::Error::ParseFailed("Incomplete taproot Tree"))
|
||||
|
|
Loading…
Reference in New Issue