From d5bdf5d2254d01b3d11a269dac380612a3510b9a Mon Sep 17 00:00:00 2001 From: Noah Lanson Date: Sun, 13 Nov 2022 18:29:17 +1100 Subject: [PATCH] Add non-generic `Witness::push_slice()` method --- bitcoin/src/blockdata/witness.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bitcoin/src/blockdata/witness.rs b/bitcoin/src/blockdata/witness.rs index 5e0cb4be..89855e55 100644 --- a/bitcoin/src/blockdata/witness.rs +++ b/bitcoin/src/blockdata/witness.rs @@ -236,7 +236,11 @@ impl Witness { /// Push a new element on the witness, requires an allocation pub fn push>(&mut self, new_element: T) { - let new_element = new_element.as_ref(); + self.push_slice(new_element.as_ref()); + } + + /// Push a new element slice onto the witness stack. + fn push_slice(&mut self, new_element: &[u8]) { self.witness_elements += 1; let previous_content_end = self.indices_start; let element_len_varint = VarInt(new_element.len() as u64);