From 73317c1c31271b65eb50c45353bf7393eba1154b Mon Sep 17 00:00:00 2001 From: aagbotemi Date: Sat, 19 Apr 2025 10:45:55 +0100 Subject: [PATCH] rename try_into_taptree into try_into_tap_tree - docs(taproot): hide deprecated try_into_taptree --- bitcoin/src/taproot/mod.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/bitcoin/src/taproot/mod.rs b/bitcoin/src/taproot/mod.rs index 0f22a40d8..13bb11b0a 100644 --- a/bitcoin/src/taproot/mod.rs +++ b/bitcoin/src/taproot/mod.rs @@ -543,7 +543,22 @@ impl TaprootBuilder { /// Converts the builder into a [`TapTree`] if the builder is a full tree and /// does not contain any hidden nodes + #[deprecated(since = "TBD", note = "use `try_into_tap_tree()` instead")] + #[doc(hidden)] pub fn try_into_taptree(self) -> Result { + self.try_into_tap_tree() + } + + /// Converts the builder into a [`TapTree`] if the builder is a full tree and + /// does not contain any hidden nodes. + /// + /// This function finalizes the taproot construction process by validating that the builder + /// is complete, and there are no hidden nodes, which would make the tree incomplete or ambiguous. + /// + /// # Errors + /// + /// Returns [`IncompleteBuilderError::HiddenParts`] if the builder contains any hidden nodes. + pub fn try_into_tap_tree(self) -> Result { let node = self.try_into_node_info()?; if node.has_hidden_nodes { // Reconstruct the builder as it was if it has hidden nodes @@ -770,7 +785,7 @@ impl TryFrom for TapTree { /// /// A [`TapTree`] iff the `builder` is complete, otherwise return [`IncompleteBuilderError`] /// error with the content of incomplete `builder` instance. - fn try_from(builder: TaprootBuilder) -> Result { builder.try_into_taptree() } + fn try_from(builder: TaprootBuilder) -> Result { builder.try_into_tap_tree() } } impl TryFrom for TapTree {