Stop using deprecated to_vec

Recently we deprecated `to_vec` in favour of `to_bytes` however we
continued to use `to_vec` in a few places. This wasn't noticed because
of our usage of `TBD` in the `deprecated` attribute.

Use `to_bytes` instead of `to_vec`.
This commit is contained in:
Tobin C. Harding 2024-09-13 08:59:24 +10:00
parent 299754c2c2
commit 8bc3b2e2c4
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
4 changed files with 5 additions and 5 deletions

View File

@ -1786,7 +1786,7 @@ mod tests {
.is_err()); .is_err());
// test that we get a failure if we corrupt a signature // test that we get a failure if we corrupt a signature
let mut witness: Vec<_> = spending.input[1].witness.to_vec(); let mut witness = spending.input[1].witness.to_bytes();
witness[0][10] = 42; witness[0][10] = 42;
spending.input[1].witness = Witness::from_slice(&witness); spending.input[1].witness = Witness::from_slice(&witness);

View File

@ -775,7 +775,7 @@ mod test {
let expected_witness = vec![hex!( let expected_witness = vec![hex!(
"304402207c800d698f4b0298c5aac830b822f011bb02df41eb114ade9a6702f364d5e39c0220366900d2a60cab903e77ef7dd415d46509b1f78ac78906e3296f495aa1b1b54101") "304402207c800d698f4b0298c5aac830b822f011bb02df41eb114ade9a6702f364d5e39c0220366900d2a60cab903e77ef7dd415d46509b1f78ac78906e3296f495aa1b1b54101")
]; ];
assert_eq!(witness.to_vec(), expected_witness); assert_eq!(witness.to_bytes(), expected_witness);
} }
#[test] #[test]

View File

@ -345,6 +345,6 @@ mod tests {
let mut buf = vec![]; let mut buf = vec![];
sig.serialize_to_writer(&mut buf).expect("write failed"); sig.serialize_to_writer(&mut buf).expect("write failed");
assert_eq!(sig.to_vec(), buf) assert_eq!(sig.to_bytes(), buf)
} }
} }

View File

@ -172,7 +172,7 @@ impl Deserialize for secp256k1::PublicKey {
} }
impl Serialize for ecdsa::Signature { impl Serialize for ecdsa::Signature {
fn serialize(&self) -> Vec<u8> { self.to_vec() } fn serialize(&self) -> Vec<u8> { self.to_bytes() }
} }
impl Deserialize for ecdsa::Signature { impl Deserialize for ecdsa::Signature {
@ -265,7 +265,7 @@ impl Deserialize for XOnlyPublicKey {
} }
impl Serialize for taproot::Signature { impl Serialize for taproot::Signature {
fn serialize(&self) -> Vec<u8> { self.to_vec() } fn serialize(&self) -> Vec<u8> { self.to_bytes() }
} }
impl Deserialize for taproot::Signature { impl Deserialize for taproot::Signature {