Rename XpubIdentifier to XKeyIdentifier
The BIP-32 extended key identifier is used to identify xpubs and xprivs, we can rename it to show this.
This commit is contained in:
parent
ffd2466ad1
commit
b2a7d7023c
|
@ -6,6 +6,8 @@
|
||||||
//! at <https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki>.
|
//! at <https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki>.
|
||||||
//!
|
//!
|
||||||
|
|
||||||
|
#![allow(deprecated)] // Remove once we remove XpubIdentifier.
|
||||||
|
|
||||||
use core::convert::TryInto;
|
use core::convert::TryInto;
|
||||||
use core::default::Default;
|
use core::default::Default;
|
||||||
use core::ops::Index;
|
use core::ops::Index;
|
||||||
|
@ -54,7 +56,11 @@ impl_bytes_newtype!(Fingerprint, 4);
|
||||||
|
|
||||||
hash_newtype! {
|
hash_newtype! {
|
||||||
/// XpubIdentifier as defined in BIP-32.
|
/// XpubIdentifier as defined in BIP-32.
|
||||||
|
#[deprecated(since = "0.0.0-NEXT-RELEASE", note = "use XKeyIdentifier instead")]
|
||||||
pub struct XpubIdentifier(hash160::Hash);
|
pub struct XpubIdentifier(hash160::Hash);
|
||||||
|
|
||||||
|
/// Extended key identifier as defined in BIP-32.
|
||||||
|
pub struct XKeyIdentifier(hash160::Hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extended private key
|
/// Extended private key
|
||||||
|
@ -676,7 +682,7 @@ impl Xpriv {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the HASH160 of the public key belonging to the xpriv
|
/// Returns the HASH160 of the public key belonging to the xpriv
|
||||||
pub fn identifier<C: secp256k1::Signing>(&self, secp: &Secp256k1<C>) -> XpubIdentifier {
|
pub fn identifier<C: secp256k1::Signing>(&self, secp: &Secp256k1<C>) -> XKeyIdentifier {
|
||||||
Xpub::from_priv(secp, self).identifier()
|
Xpub::from_priv(secp, self).identifier()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -807,10 +813,10 @@ impl Xpub {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the HASH160 of the chaincode
|
/// Returns the HASH160 of the chaincode
|
||||||
pub fn identifier(&self) -> XpubIdentifier {
|
pub fn identifier(&self) -> XKeyIdentifier {
|
||||||
let mut engine = XpubIdentifier::engine();
|
let mut engine = XKeyIdentifier::engine();
|
||||||
engine.write_all(&self.public_key.serialize()).expect("engines don't error");
|
engine.write_all(&self.public_key.serialize()).expect("engines don't error");
|
||||||
XpubIdentifier::from_engine(engine)
|
XKeyIdentifier::from_engine(engine)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the first four bytes of the identifier
|
/// Returns the first four bytes of the identifier
|
||||||
|
@ -859,12 +865,12 @@ impl FromStr for Xpub {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Xpub> for XpubIdentifier {
|
impl From<Xpub> for XKeyIdentifier {
|
||||||
fn from(key: Xpub) -> XpubIdentifier { key.identifier() }
|
fn from(key: Xpub) -> XKeyIdentifier { key.identifier() }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<&Xpub> for XpubIdentifier {
|
impl From<&Xpub> for XKeyIdentifier {
|
||||||
fn from(key: &Xpub) -> XpubIdentifier { key.identifier() }
|
fn from(key: &Xpub) -> XKeyIdentifier { key.identifier() }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
|
@ -129,7 +129,7 @@ use core2::io;
|
||||||
|
|
||||||
pub use crate::address::{Address, AddressType};
|
pub use crate::address::{Address, AddressType};
|
||||||
pub use crate::amount::{Amount, Denomination, SignedAmount};
|
pub use crate::amount::{Amount, Denomination, SignedAmount};
|
||||||
pub use crate::bip32::XpubIdentifier;
|
pub use crate::bip32::XKeyIdentifier;
|
||||||
pub use crate::blockdata::block::{self, Block};
|
pub use crate::blockdata::block::{self, Block};
|
||||||
pub use crate::blockdata::fee_rate::FeeRate;
|
pub use crate::blockdata::fee_rate::FeeRate;
|
||||||
pub use crate::blockdata::locktime::{self, absolute, relative};
|
pub use crate::blockdata::locktime::{self, absolute, relative};
|
||||||
|
|
Loading…
Reference in New Issue