Rename TaprootBuilder::is_complete into is_finalized
This commit is contained in:
parent
efa800fb1f
commit
b0f3992db1
|
@ -141,7 +141,7 @@ impl TapTree {
|
||||||
/// A [`TapTree`] iff the `inner` builder is complete, otherwise return [`IncompleteTapTree`]
|
/// A [`TapTree`] iff the `inner` builder is complete, otherwise return [`IncompleteTapTree`]
|
||||||
/// error with the content of incomplete builder `inner` instance.
|
/// error with the content of incomplete builder `inner` instance.
|
||||||
pub fn from_inner(inner: TaprootBuilder) -> Result<Self, IncompleteTapTree> {
|
pub fn from_inner(inner: TaprootBuilder) -> Result<Self, IncompleteTapTree> {
|
||||||
if !inner.is_complete() {
|
if !inner.is_finalized() {
|
||||||
Err(IncompleteTapTree::NotFinalized(inner))
|
Err(IncompleteTapTree::NotFinalized(inner))
|
||||||
} else {
|
} else {
|
||||||
Ok(TapTree(inner))
|
Ok(TapTree(inner))
|
||||||
|
|
|
@ -355,7 +355,7 @@ impl Deserialize for TapTree {
|
||||||
builder = builder.add_leaf_with_ver(*depth, script, leaf_version)
|
builder = builder.add_leaf_with_ver(*depth, script, leaf_version)
|
||||||
.map_err(|_| encode::Error::ParseFailed("Tree not in DFS order"))?;
|
.map_err(|_| encode::Error::ParseFailed("Tree not in DFS order"))?;
|
||||||
}
|
}
|
||||||
if builder.is_complete() {
|
if builder.is_finalized() {
|
||||||
Ok(TapTree(builder))
|
Ok(TapTree(builder))
|
||||||
} else {
|
} else {
|
||||||
Err(encode::Error::ParseFailed("Incomplete taproot Tree"))
|
Err(encode::Error::ParseFailed("Incomplete taproot Tree"))
|
||||||
|
|
|
@ -461,8 +461,8 @@ impl TaprootBuilder {
|
||||||
self.insert(node, depth)
|
self.insert(node, depth)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks if the builder is a complete tree.
|
/// Checks if the builder has finalized building a tree.
|
||||||
pub fn is_complete(&self) -> bool {
|
pub fn is_finalized(&self) -> bool {
|
||||||
self.branch.len() == 1 && self.branch[0].is_some()
|
self.branch.len() == 1 && self.branch[0].is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue