Rename TaprootBuilder::is_complete into is_finalized

This commit is contained in:
Dr Maxim Orlovsky 2022-04-05 22:26:36 +02:00
parent efa800fb1f
commit b0f3992db1
No known key found for this signature in database
GPG Key ID: FFC0250947E5C6F7
3 changed files with 4 additions and 4 deletions

View File

@ -141,7 +141,7 @@ impl TapTree {
/// A [`TapTree`] iff the `inner` builder is complete, otherwise return [`IncompleteTapTree`]
/// error with the content of incomplete builder `inner` instance.
pub fn from_inner(inner: TaprootBuilder) -> Result<Self, IncompleteTapTree> {
if !inner.is_complete() {
if !inner.is_finalized() {
Err(IncompleteTapTree::NotFinalized(inner))
} else {
Ok(TapTree(inner))

View File

@ -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_complete() {
if builder.is_finalized() {
Ok(TapTree(builder))
} else {
Err(encode::Error::ParseFailed("Incomplete taproot Tree"))

View File

@ -461,8 +461,8 @@ impl TaprootBuilder {
self.insert(node, depth)
}
/// Checks if the builder is a complete tree.
pub fn is_complete(&self) -> bool {
/// Checks if the builder has finalized building a tree.
pub fn is_finalized(&self) -> bool {
self.branch.len() == 1 && self.branch[0].is_some()
}