From c528f52894ed0e769aff3dd13bc0fee4087d47c1 Mon Sep 17 00:00:00 2001 From: Martin Habovstiak Date: Sun, 16 Mar 2025 20:00:21 +0100 Subject: [PATCH] Change `Deref::Target` of `TaprootMerkleBranchBuf` `TaprootMerkleBranchBuf` previously derefed to a slice which lost the information about length being valid. This commit changes the type which, while API-breaking, is not disruptive because the type has API very similar to slice. --- bitcoin/src/taproot/merkle_branch/buf.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bitcoin/src/taproot/merkle_branch/buf.rs b/bitcoin/src/taproot/merkle_branch/buf.rs index 1902d9b2a..d06ffcadf 100644 --- a/bitcoin/src/taproot/merkle_branch/buf.rs +++ b/bitcoin/src/taproot/merkle_branch/buf.rs @@ -181,15 +181,15 @@ impl<'a> IntoIterator for &'a mut TaprootMerkleBranchBuf { } impl core::ops::Deref for TaprootMerkleBranchBuf { - type Target = [TapNodeHash]; + type Target = TaprootMerkleBranch; #[inline] - fn deref(&self) -> &Self::Target { &self.0 } + fn deref(&self) -> &Self::Target { self.as_ref() } } impl core::ops::DerefMut for TaprootMerkleBranchBuf { #[inline] - fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } + fn deref_mut(&mut self) -> &mut Self::Target { self.as_mut() } } impl AsRef<[TapNodeHash]> for TaprootMerkleBranchBuf {