Skip to content

Commit

Permalink
Rename is_finalized to is_finalizable
Browse files Browse the repository at this point in the history
I really liked the is_complete naming, but that was changed earlier in b0f3992
Was also suggested by Andrew #929 (comment)
  • Loading branch information
sanket1729 committed Jul 29, 2022
1 parent aaadd25 commit 870ad59
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/util/psbt/map/output.rs
Expand Up @@ -194,7 +194,7 @@ impl TryFrom<TaprootBuilder> for TapTree {
/// A [`TapTree`] iff the `builder` is complete, otherwise return [`IncompleteTapTree`]
/// error with the content of incomplete `builder` instance.
fn try_from(builder: TaprootBuilder) -> Result<Self, Self::Error> {
if !builder.is_finalized() {
if !builder.is_finalizable() {
Err(IncompleteTapTree::NotFinalized(builder))
} else if builder.has_hidden_nodes() {
Err(IncompleteTapTree::HiddenParts(builder))
Expand Down
2 changes: 1 addition & 1 deletion src/util/psbt/serialize.rs
Expand Up @@ -343,7 +343,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() && !builder.has_hidden_nodes() {
if builder.is_finalizable() && !builder.has_hidden_nodes() {
Ok(TapTree(builder))
} else {
Err(encode::Error::ParseFailed("Incomplete taproot Tree"))
Expand Down
6 changes: 3 additions & 3 deletions src/util/taproot.rs
Expand Up @@ -441,7 +441,7 @@ impl TaprootBuilder {
}

/// Checks if the builder has finalized building a tree.
pub fn is_finalized(&self) -> bool {
pub fn is_finalizable(&self) -> bool {
self.branch.len() == 1 && self.branch[0].is_some()
}

Expand All @@ -452,8 +452,8 @@ impl TaprootBuilder {

/// Creates a [`TaprootSpendInfo`] with the given internal key.
///
/// Returns the unmodified builder as Err if the builder is not finalized.
/// See also [`TaprootBuilder::is_finalized`]
/// Returns the unmodified builder as Err if the builder is not finalizable.
/// See also [`TaprootBuilder::is_finalizable`]
pub fn finalize<C: secp256k1::Verification>(
mut self,
secp: &Secp256k1<C>,
Expand Down

0 comments on commit 870ad59

Please sign in to comment.