Rename is_finalized to is_finalizable

I really liked the is_complete naming, but that was changed earlier in b0f3992db1
Was also suggested by Andrew https://github.com/rust-bitcoin/rust-bitcoin/pull/929#discussion_r850631207
This commit is contained in:
sanket1729 2022-07-28 17:33:26 -07:00
parent aaadd25ddc
commit 870ad59a5e
3 changed files with 5 additions and 5 deletions

View File

@ -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))

View File

@ -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"))

View File

@ -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<C: secp256k1::Verification>(
mut self,
secp: &Secp256k1<C>,