From 370c2597c61c2a4ba9b688df4cef9464bd473dd8 Mon Sep 17 00:00:00 2001 From: Martin Habovstiak Date: Sun, 16 Mar 2025 10:17:49 +0100 Subject: [PATCH] Add `as_mut_slice` to `TaprootMerkleBranchBuf` `TaprootMerkleBranchBuf` already had `as_slice` method and `DerefMut` but was missing `as_slice_mut`, so this change adds it. --- bitcoin/src/taproot/merkle_branch/buf.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bitcoin/src/taproot/merkle_branch/buf.rs b/bitcoin/src/taproot/merkle_branch/buf.rs index d89559fcc..657929cd3 100644 --- a/bitcoin/src/taproot/merkle_branch/buf.rs +++ b/bitcoin/src/taproot/merkle_branch/buf.rs @@ -27,6 +27,10 @@ impl TaprootMerkleBranchBuf { #[inline] pub fn as_slice(&self) -> &[TapNodeHash] { &self.0 } + /// Returns a mutable reference to the slice of hashes. + #[inline] + pub fn as_mut_slice(&mut self) -> &mut [TapNodeHash] { &mut self.0 } + /// Returns the number of nodes in this Merkle proof. #[inline] pub fn len(&self) -> usize { self.0.len() }