Move XpubIdentifier to the bip32 module
As we have recently been doing, move the declaration of the hash type to where it is used. Move the `XpubIdentifier` hash declaration to the `bip32` module. This is an API breaking change.
This commit is contained in:
parent
c06c9beb01
commit
ffd2466ad1
|
@ -12,7 +12,7 @@ use core::ops::Index;
|
||||||
use core::str::FromStr;
|
use core::str::FromStr;
|
||||||
use core::{fmt, slice};
|
use core::{fmt, slice};
|
||||||
|
|
||||||
use hashes::{sha512, Hash, HashEngine, Hmac, HmacEngine};
|
use hashes::{hash160, hash_newtype, sha512, Hash, HashEngine, Hmac, HmacEngine};
|
||||||
use internals::{impl_array_newtype, write_err};
|
use internals::{impl_array_newtype, write_err};
|
||||||
use secp256k1::{self, Secp256k1, XOnlyPublicKey};
|
use secp256k1::{self, Secp256k1, XOnlyPublicKey};
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
|
@ -20,7 +20,6 @@ use serde;
|
||||||
|
|
||||||
use crate::base58;
|
use crate::base58;
|
||||||
use crate::crypto::key::{self, KeyPair, PrivateKey, PublicKey};
|
use crate::crypto::key::{self, KeyPair, PrivateKey, PublicKey};
|
||||||
use crate::hash_types::XpubIdentifier;
|
|
||||||
use crate::internal_macros::impl_bytes_newtype;
|
use crate::internal_macros::impl_bytes_newtype;
|
||||||
use crate::io::Write;
|
use crate::io::Write;
|
||||||
use crate::network::Network;
|
use crate::network::Network;
|
||||||
|
@ -53,6 +52,11 @@ pub struct Fingerprint([u8; 4]);
|
||||||
impl_array_newtype!(Fingerprint, u8, 4);
|
impl_array_newtype!(Fingerprint, u8, 4);
|
||||||
impl_bytes_newtype!(Fingerprint, 4);
|
impl_bytes_newtype!(Fingerprint, 4);
|
||||||
|
|
||||||
|
hash_newtype! {
|
||||||
|
/// XpubIdentifier as defined in BIP-32.
|
||||||
|
pub struct XpubIdentifier(hash160::Hash);
|
||||||
|
}
|
||||||
|
|
||||||
/// Extended private key
|
/// Extended private key
|
||||||
#[derive(Copy, Clone, PartialEq, Eq)]
|
#[derive(Copy, Clone, PartialEq, Eq)]
|
||||||
#[cfg_attr(feature = "std", derive(Debug))]
|
#[cfg_attr(feature = "std", derive(Debug))]
|
||||||
|
|
|
@ -52,7 +52,7 @@ pub use newtypes::*;
|
||||||
|
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
mod newtypes {
|
mod newtypes {
|
||||||
use hashes::{sha256d, hash160, hash_newtype};
|
use hashes::{sha256d, hash_newtype};
|
||||||
|
|
||||||
hash_newtype! {
|
hash_newtype! {
|
||||||
/// A bitcoin transaction hash/transaction ID.
|
/// A bitcoin transaction hash/transaction ID.
|
||||||
|
@ -75,8 +75,6 @@ mod newtypes {
|
||||||
pub struct WitnessMerkleNode(sha256d::Hash);
|
pub struct WitnessMerkleNode(sha256d::Hash);
|
||||||
/// A hash corresponding to the witness structure commitment in the coinbase transaction
|
/// A hash corresponding to the witness structure commitment in the coinbase transaction
|
||||||
pub struct WitnessCommitment(sha256d::Hash);
|
pub struct WitnessCommitment(sha256d::Hash);
|
||||||
/// XpubIdentifier as defined in BIP-32.
|
|
||||||
pub struct XpubIdentifier(hash160::Hash);
|
|
||||||
|
|
||||||
/// Filter hash, as defined in BIP-157
|
/// Filter hash, as defined in BIP-157
|
||||||
pub struct FilterHash(sha256d::Hash);
|
pub struct FilterHash(sha256d::Hash);
|
||||||
|
|
|
@ -129,6 +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::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};
|
||||||
|
@ -147,7 +148,6 @@ pub use crate::crypto::key::{
|
||||||
pub use crate::crypto::sighash::{self, LegacySighash, SegwitV0Sighash, TapSighash, TapSighashTag};
|
pub use crate::crypto::sighash::{self, LegacySighash, SegwitV0Sighash, TapSighash, TapSighashTag};
|
||||||
pub use crate::hash_types::{
|
pub use crate::hash_types::{
|
||||||
BlockHash, FilterHash, FilterHeader, TxMerkleNode, Txid, WitnessCommitment, Wtxid,
|
BlockHash, FilterHash, FilterHeader, TxMerkleNode, Txid, WitnessCommitment, Wtxid,
|
||||||
XpubIdentifier,
|
|
||||||
};
|
};
|
||||||
pub use crate::merkle_tree::MerkleBlock;
|
pub use crate::merkle_tree::MerkleBlock;
|
||||||
pub use crate::network::Network;
|
pub use crate::network::Network;
|
||||||
|
|
Loading…
Reference in New Issue