From 870ad59a5e71bd34707fa767581780e33d31985e Mon Sep 17 00:00:00 2001 From: sanket1729 Date: Thu, 28 Jul 2022 17:33:26 -0700 Subject: [PATCH] Rename is_finalized to is_finalizable I really liked the is_complete naming, but that was changed earlier in b0f3992db16cbfb571160039f59e0c426404b997 Was also suggested by Andrew https://github.com/rust-bitcoin/rust-bitcoin/pull/929#discussion_r850631207 --- src/util/psbt/map/output.rs | 2 +- src/util/psbt/serialize.rs | 2 +- src/util/taproot.rs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/util/psbt/map/output.rs b/src/util/psbt/map/output.rs index 74d27d5ac2..2545c1e937 100644 --- a/src/util/psbt/map/output.rs +++ b/src/util/psbt/map/output.rs @@ -194,7 +194,7 @@ impl TryFrom 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 { - if !builder.is_finalized() { + if !builder.is_finalizable() { Err(IncompleteTapTree::NotFinalized(builder)) } else if builder.has_hidden_nodes() { Err(IncompleteTapTree::HiddenParts(builder)) diff --git a/src/util/psbt/serialize.rs b/src/util/psbt/serialize.rs index 441728a3bc..c10b98f286 100644 --- a/src/util/psbt/serialize.rs +++ b/src/util/psbt/serialize.rs @@ -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")) diff --git a/src/util/taproot.rs b/src/util/taproot.rs index 17d1ac9488..8658093a74 100644 --- a/src/util/taproot.rs +++ b/src/util/taproot.rs @@ -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() } @@ -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( mut self, secp: &Secp256k1,