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`.
This commit is contained in:
Martin Habovstiak 2025-03-16 20:06:57 +01:00
parent c528f52894
commit 9ea2e9262f
1 changed files with 4 additions and 4 deletions

View File

@ -1096,9 +1096,9 @@ impl LeafNode {
pub fn leaf_version(&self) -> Option<LeafVersion> { self.leaf.as_script().map(|x| x.1) } pub fn leaf_version(&self) -> Option<LeafVersion> { self.leaf.as_script().map(|x| x.1) }
/// Returns reference to the Merkle proof (hashing partners) to get this /// Returns reference to the Merkle proof (hashing partners) to get this
/// node in form of [`TaprootMerkleBranchBuf`]. /// node in form of [`TaprootMerkleBranch`].
#[inline] #[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`]. /// Returns a reference to the leaf of this [`ScriptLeaf`].
#[inline] #[inline]
@ -1114,7 +1114,7 @@ pub struct ScriptLeaf<'leaf> {
/// The script. /// The script.
script: &'leaf Script, script: &'leaf Script,
/// The Merkle proof (hashing partners) to get this node. /// The Merkle proof (hashing partners) to get this node.
merkle_branch: &'leaf TaprootMerkleBranchBuf, merkle_branch: &'leaf TaprootMerkleBranch,
} }
impl<'leaf> ScriptLeaf<'leaf> { impl<'leaf> ScriptLeaf<'leaf> {
@ -1125,7 +1125,7 @@ impl<'leaf> ScriptLeaf<'leaf> {
pub fn script(&self) -> &Script { self.script } pub fn script(&self) -> &Script { self.script }
/// Obtains a reference to the Merkle proof of the leaf. /// 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. /// Obtains a script leaf from the leaf node if the leaf is not hidden.
pub fn from_leaf_node(leaf_node: &'leaf LeafNode) -> Option<Self> { pub fn from_leaf_node(leaf_node: &'leaf LeafNode) -> Option<Self> {