Deprecate `PrivateKey::from_slice` method
Since arrays better convey the intention than slices when parsing fixed-sized bytes we're migrating to them. This deprecates the `from_slice` method similarly to how we do it elsewhere.
This commit is contained in:
parent
0d5cd7af43
commit
8efacd4dda
|
@ -468,6 +468,7 @@ impl PrivateKey {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Deserializes a private key from a slice.
|
/// Deserializes a private key from a slice.
|
||||||
|
#[deprecated(since = "TBD", note = "use from_byte_array instead")]
|
||||||
pub fn from_slice(
|
pub fn from_slice(
|
||||||
data: &[u8],
|
data: &[u8],
|
||||||
network: impl Into<NetworkKind>,
|
network: impl Into<NetworkKind>,
|
||||||
|
@ -1606,6 +1607,8 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[allow(deprecated)] // tests the deprecated function
|
||||||
|
#[allow(deprecated_in_future)]
|
||||||
fn invalid_private_key_len() {
|
fn invalid_private_key_len() {
|
||||||
use crate::Network;
|
use crate::Network;
|
||||||
assert!(PrivateKey::from_slice(&[1u8; 31], Network::Regtest).is_err());
|
assert!(PrivateKey::from_slice(&[1u8; 31], Network::Regtest).is_err());
|
||||||
|
|
Loading…
Reference in New Issue