From 9ea2e9262fbc04ea6fad33047de0fc1ead999dc7 Mon Sep 17 00:00:00 2001 From: Martin Habovstiak Date: Sun, 16 Mar 2025 20:06:57 +0100 Subject: [PATCH] Don't use references to `TaprootMerkleBranchBuf` The new unsized type is more flexible and so are the references to it. Just like we pass around `&str` instead of `&String` we should be passing `&TaprootMerkleBranch` instead of `&TaprootMerkleBranchBuf`. --- bitcoin/src/taproot/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bitcoin/src/taproot/mod.rs b/bitcoin/src/taproot/mod.rs index 619f5edc8..a3358964a 100644 --- a/bitcoin/src/taproot/mod.rs +++ b/bitcoin/src/taproot/mod.rs @@ -1096,9 +1096,9 @@ impl LeafNode { pub fn leaf_version(&self) -> Option { self.leaf.as_script().map(|x| x.1) } /// Returns reference to the Merkle proof (hashing partners) to get this - /// node in form of [`TaprootMerkleBranchBuf`]. + /// node in form of [`TaprootMerkleBranch`]. #[inline] - pub fn merkle_branch(&self) -> &TaprootMerkleBranchBuf { &self.merkle_branch } + pub fn merkle_branch(&self) -> &TaprootMerkleBranch { &self.merkle_branch } /// Returns a reference to the leaf of this [`ScriptLeaf`]. #[inline] @@ -1114,7 +1114,7 @@ pub struct ScriptLeaf<'leaf> { /// The script. script: &'leaf Script, /// The Merkle proof (hashing partners) to get this node. - merkle_branch: &'leaf TaprootMerkleBranchBuf, + merkle_branch: &'leaf TaprootMerkleBranch, } impl<'leaf> ScriptLeaf<'leaf> { @@ -1125,7 +1125,7 @@ impl<'leaf> ScriptLeaf<'leaf> { pub fn script(&self) -> &Script { self.script } /// Obtains a reference to the Merkle proof of the leaf. - pub fn merkle_branch(&self) -> &TaprootMerkleBranchBuf { self.merkle_branch } + pub fn merkle_branch(&self) -> &TaprootMerkleBranch { self.merkle_branch } /// Obtains a script leaf from the leaf node if the leaf is not hidden. pub fn from_leaf_node(leaf_node: &'leaf LeafNode) -> Option {