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:
Tobin C. Harding 2023-08-22 09:27:17 +10:00
parent c06c9beb01
commit ffd2466ad1
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
3 changed files with 8 additions and 6 deletions

View File

@ -12,7 +12,7 @@ use core::ops::Index;
use core::str::FromStr;
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 secp256k1::{self, Secp256k1, XOnlyPublicKey};
#[cfg(feature = "serde")]
@ -20,7 +20,6 @@ use serde;
use crate::base58;
use crate::crypto::key::{self, KeyPair, PrivateKey, PublicKey};
use crate::hash_types::XpubIdentifier;
use crate::internal_macros::impl_bytes_newtype;
use crate::io::Write;
use crate::network::Network;
@ -53,6 +52,11 @@ pub struct Fingerprint([u8; 4]);
impl_array_newtype!(Fingerprint, u8, 4);
impl_bytes_newtype!(Fingerprint, 4);
hash_newtype! {
/// XpubIdentifier as defined in BIP-32.
pub struct XpubIdentifier(hash160::Hash);
}
/// Extended private key
#[derive(Copy, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Debug))]

View File

@ -52,7 +52,7 @@ pub use newtypes::*;
#[rustfmt::skip]
mod newtypes {
use hashes::{sha256d, hash160, hash_newtype};
use hashes::{sha256d, hash_newtype};
hash_newtype! {
/// A bitcoin transaction hash/transaction ID.
@ -75,8 +75,6 @@ mod newtypes {
pub struct WitnessMerkleNode(sha256d::Hash);
/// A hash corresponding to the witness structure commitment in the coinbase transaction
pub struct WitnessCommitment(sha256d::Hash);
/// XpubIdentifier as defined in BIP-32.
pub struct XpubIdentifier(hash160::Hash);
/// Filter hash, as defined in BIP-157
pub struct FilterHash(sha256d::Hash);

View File

@ -129,6 +129,7 @@ use core2::io;
pub use crate::address::{Address, AddressType};
pub use crate::amount::{Amount, Denomination, SignedAmount};
pub use crate::bip32::XpubIdentifier;
pub use crate::blockdata::block::{self, Block};
pub use crate::blockdata::fee_rate::FeeRate;
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::hash_types::{
BlockHash, FilterHash, FilterHeader, TxMerkleNode, Txid, WitnessCommitment, Wtxid,
XpubIdentifier,
};
pub use crate::merkle_tree::MerkleBlock;
pub use crate::network::Network;