From 6389d1cbb30441cd54f675df1399bcb90e093906 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Tue, 24 Sep 2024 10:25:03 +1000 Subject: [PATCH] Stop using push_slice The `Witness::push_slice` function is called by `Witness::push` after calling `as_ref`, hence is equivalent for all types that implement `AsRef<[u8]>`. Also, `push_slice` is a private method on `Witness`. In preparation for moving `Witness` over to `primitives` stop using `push_slice` in favour of `push`. Internal change only. --- bitcoin/src/blockdata/witness.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bitcoin/src/blockdata/witness.rs b/bitcoin/src/blockdata/witness.rs index 12cd648d92..3ece6fcc8a 100644 --- a/bitcoin/src/blockdata/witness.rs +++ b/bitcoin/src/blockdata/witness.rs @@ -252,15 +252,15 @@ impl Witness { /// It is expected that `pubkey` is related to the secret key used to create `signature`. pub fn p2wpkh(signature: ecdsa::Signature, pubkey: secp256k1::PublicKey) -> Witness { let mut witness = Witness::new(); - witness.push_slice(&signature.serialize()); - witness.push_slice(&pubkey.serialize()); + witness.push(signature.serialize()); + witness.push(pubkey.serialize()); witness } /// Creates a witness required to do a key path spend of a P2TR output. pub fn p2tr_key_spend(signature: &taproot::Signature) -> Witness { let mut witness = Witness::new(); - witness.push_slice(&signature.serialize()); + witness.push(signature.serialize()); witness } @@ -363,7 +363,7 @@ impl Witness { /// /// Pushes the DER encoded signature + sighash_type, requires an allocation. pub fn push_ecdsa_signature(&mut self, signature: ecdsa::Signature) { - self.push_slice(&signature.serialize()) + self.push(signature.serialize()) } /// Note `index` is the index into the `content` vector and should be the result of calling