diff --git a/bitcoin/src/blockdata/script/tests.rs b/bitcoin/src/blockdata/script/tests.rs index 693f36e2b..5a9878a59 100644 --- a/bitcoin/src/blockdata/script/tests.rs +++ b/bitcoin/src/blockdata/script/tests.rs @@ -54,7 +54,7 @@ fn p2pk_pubkey_bytes_valid_key_and_valid_script_returns_expected_key() { let key = key_str.parse::().unwrap(); let p2pk = Script::builder().push_key(key).push_opcode(OP_CHECKSIG).into_script(); let actual = p2pk.p2pk_pubkey_bytes().unwrap(); - assert_eq!(actual.to_vec(), key.to_bytes()); + assert_eq!(actual.to_vec(), key.to_vec()); } #[test] @@ -109,7 +109,7 @@ fn p2pk_pubkey_bytes_compressed_key_returns_expected_key() { let key = compressed_key_str.parse::().unwrap(); let p2pk = Script::builder().push_key(key).push_opcode(OP_CHECKSIG).into_script(); let actual = p2pk.p2pk_pubkey_bytes().unwrap(); - assert_eq!(actual.to_vec(), key.to_bytes()); + assert_eq!(actual.to_vec(), key.to_vec()); } #[test] diff --git a/bitcoin/src/crypto/key.rs b/bitcoin/src/crypto/key.rs index 931fc8808..0bac43000 100644 --- a/bitcoin/src/crypto/key.rs +++ b/bitcoin/src/crypto/key.rs @@ -110,7 +110,11 @@ impl PublicKey { } /// Serializes the public key to bytes. - pub fn to_bytes(self) -> Vec { + #[deprecated(since = "TBD", note = "use to_vec instead")] + pub fn to_bytes(self) -> Vec { self.to_vec() } + + /// Serializes the public key to bytes. + pub fn to_vec(self) -> Vec { let mut buf = Vec::new(); self.write_into(&mut buf).expect("vecs don't error"); buf @@ -442,8 +446,13 @@ impl PrivateKey { } } + /// Serializes the private key to bytes. - pub fn to_bytes(self) -> Vec { self.inner[..].to_vec() } + #[deprecated(since = "TBD", note = "use to_vec instead")] + pub fn to_bytes(self) -> Vec { self.to_vec() } + + /// Serializes the private key to bytes. + pub fn to_vec(self) -> Vec { self.inner[..].to_vec() } /// Deserializes a private key from a slice. pub fn from_slice(