Merge rust-bitcoin/rust-bitcoin#4369: Rename `try_into_taptree` to `try_into_tap_tree`
73317c1c31
rename try_into_taptree into try_into_tap_tree - docs(taproot): hide deprecated try_into_taptree (aagbotemi)
Pull request description:
The PR introduces a new function `try_into_tap_tree()` to replace `try_into_taptree()`. `try_into_taptree()` has been deprecated.
This PR fixes #4364
ACKs for top commit:
apoelstra:
ACK 73317c1c31271b65eb50c45353bf7393eba1154b; successfully ran local tests
Tree-SHA512: 5d853ea05a8cacfc0a27a93bed4351409abf5f93e53b308d62efdc3966c8403a4a857e39882eb84e511b637763ddb9629be832c2079057d81fa1c1984bcb8ad7
This commit is contained in:
commit
b67b9de765
|
@ -543,7 +543,22 @@ impl TaprootBuilder {
|
||||||
|
|
||||||
/// Converts the builder into a [`TapTree`] if the builder is a full tree and
|
/// Converts the builder into a [`TapTree`] if the builder is a full tree and
|
||||||
/// does not contain any hidden nodes
|
/// 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<TapTree, IncompleteBuilderError> {
|
pub fn try_into_taptree(self) -> Result<TapTree, IncompleteBuilderError> {
|
||||||
|
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<TapTree, IncompleteBuilderError> {
|
||||||
let node = self.try_into_node_info()?;
|
let node = self.try_into_node_info()?;
|
||||||
if node.has_hidden_nodes {
|
if node.has_hidden_nodes {
|
||||||
// Reconstruct the builder as it was if it has hidden nodes
|
// Reconstruct the builder as it was if it has hidden nodes
|
||||||
|
@ -770,7 +785,7 @@ impl TryFrom<TaprootBuilder> for TapTree {
|
||||||
///
|
///
|
||||||
/// A [`TapTree`] iff the `builder` is complete, otherwise return [`IncompleteBuilderError`]
|
/// A [`TapTree`] iff the `builder` is complete, otherwise return [`IncompleteBuilderError`]
|
||||||
/// error with the content of incomplete `builder` instance.
|
/// error with the content of incomplete `builder` instance.
|
||||||
fn try_from(builder: TaprootBuilder) -> Result<Self, Self::Error> { builder.try_into_taptree() }
|
fn try_from(builder: TaprootBuilder) -> Result<Self, Self::Error> { builder.try_into_tap_tree() }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<NodeInfo> for TapTree {
|
impl TryFrom<NodeInfo> for TapTree {
|
||||||
|
|
Loading…
Reference in New Issue