Move the address module out of util
The identifier 'util' does not convey any information. We have a whole bunch of modules inside the `util` module. As part of work to reduce the amount of arbitrary things in the `util` module move the `address` module to the crate root level.
This commit is contained in:
parent
6cc8b22f82
commit
e1ae9d86bb
|
@ -6,7 +6,7 @@ use std::{env, process};
|
|||
use bitcoin::hashes::hex::FromHex;
|
||||
use bitcoin::secp256k1::ffi::types::AlignedType;
|
||||
use bitcoin::secp256k1::Secp256k1;
|
||||
use bitcoin::util::address::Address;
|
||||
use bitcoin::address::Address;
|
||||
use bitcoin::util::bip32::{ChildNumber, DerivationPath, ExtendedPrivKey, ExtendedPubKey};
|
||||
use bitcoin::PublicKey;
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ use std::str::FromStr;
|
|||
use bitcoin::consensus::encode;
|
||||
use bitcoin::hashes::hex::{self, FromHex};
|
||||
use bitcoin::secp256k1::{Secp256k1, Signing, Verification};
|
||||
use bitcoin::util::address;
|
||||
use bitcoin::util::amount::ParseAmountError;
|
||||
use bitcoin::util::bip32::{
|
||||
self, ChildNumber, DerivationPath, ExtendedPrivKey, ExtendedPubKey, Fingerprint,
|
||||
|
@ -44,7 +43,7 @@ use bitcoin::util::bip32::{
|
|||
use bitcoin::util::psbt::{self, Input, Psbt, PsbtSighashType};
|
||||
use bitcoin::{
|
||||
Address, Amount, Network, OutPoint, PackedLockTime, PrivateKey, PublicKey, Script, Sequence,
|
||||
Transaction, TxIn, TxOut, Txid, Witness,
|
||||
Transaction, TxIn, TxOut, Txid, Witness, address,
|
||||
};
|
||||
|
||||
use self::psbt_sign::*;
|
||||
|
|
|
@ -2,7 +2,7 @@ extern crate bitcoin;
|
|||
use std::str::FromStr;
|
||||
fn do_test(data: &[u8]) {
|
||||
let data_str = String::from_utf8_lossy(data);
|
||||
let addr = match bitcoin::util::address::Address::from_str(&data_str) {
|
||||
let addr = match bitcoin::address::Address::from_str(&data_str) {
|
||||
Ok(addr) => addr,
|
||||
Err(_) => return,
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
extern crate bitcoin;
|
||||
|
||||
use bitcoin::util::address::Address;
|
||||
use bitcoin::address::Address;
|
||||
use bitcoin::network::constants::Network;
|
||||
use bitcoin::blockdata::script;
|
||||
use bitcoin::consensus::encode;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
//!
|
||||
//! ```rust
|
||||
//! use bitcoin::network::constants::Network;
|
||||
//! use bitcoin::util::address::Address;
|
||||
//! use bitcoin::address::Address;
|
||||
//! use bitcoin::PublicKey;
|
||||
//! use bitcoin::secp256k1::Secp256k1;
|
||||
//! use bitcoin::secp256k1::rand::thread_rng;
|
|
@ -32,7 +32,7 @@ use crate::policy::DUST_RELAY_TX_FEE;
|
|||
use crate::OutPoint;
|
||||
|
||||
use crate::util::key::PublicKey;
|
||||
use crate::util::address::WitnessVersion;
|
||||
use crate::address::WitnessVersion;
|
||||
use crate::util::taproot::{LeafVersion, TapBranchHash, TapLeafHash};
|
||||
use secp256k1::{Secp256k1, Verification, XOnlyPublicKey};
|
||||
use crate::schnorr::{TapTweak, TweakedPublicKey, UntweakedPublicKey};
|
||||
|
|
|
@ -79,6 +79,7 @@ mod serde_utils;
|
|||
|
||||
#[macro_use]
|
||||
pub mod network;
|
||||
pub mod address;
|
||||
pub mod blockdata;
|
||||
pub mod consensus;
|
||||
pub mod error;
|
||||
|
@ -104,7 +105,7 @@ pub use crate::blockdata::witness::Witness;
|
|||
pub use crate::consensus::encode::VarInt;
|
||||
pub use crate::hash_types::*;
|
||||
pub use crate::network::constants::Network;
|
||||
pub use crate::util::address::{Address, AddressType};
|
||||
pub use crate::address::{Address, AddressType};
|
||||
pub use crate::util::amount::{Amount, Denomination, SignedAmount};
|
||||
pub use crate::util::ecdsa::{self, EcdsaSig, EcdsaSigError};
|
||||
pub use crate::util::key::{KeyPair, PrivateKey, PublicKey, XOnlyPublicKey};
|
||||
|
|
|
@ -552,7 +552,7 @@ mod tests {
|
|||
use crate::hashes::hex::{FromHex, ToHex};
|
||||
use crate::network::constants::Network::Testnet;
|
||||
use crate::network::constants::Network::Bitcoin;
|
||||
use crate::util::address::Address;
|
||||
use crate::address::Address;
|
||||
|
||||
#[test]
|
||||
fn test_key_derivation() {
|
||||
|
|
|
@ -32,7 +32,7 @@ mod message_signing {
|
|||
use secp256k1::ecdsa::{RecoveryId, RecoverableSignature};
|
||||
|
||||
use crate::util::key::PublicKey;
|
||||
use crate::util::address::{Address, AddressType};
|
||||
use crate::address::{Address, AddressType};
|
||||
use crate::internal_macros::write_err;
|
||||
|
||||
/// An error used for dealing with Bitcoin Signed Messages.
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
pub mod key;
|
||||
pub mod ecdsa;
|
||||
pub mod schnorr;
|
||||
pub mod address;
|
||||
pub mod amount;
|
||||
pub mod base58;
|
||||
pub mod bip32;
|
||||
|
@ -111,3 +110,10 @@ pub(crate) fn read_to_end<D: io::Read>(mut d: D) -> Result<Vec<u8>, io::Error> {
|
|||
}
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
/// The `address` module now lives at the crate root, re-export everything so as not to break the
|
||||
/// API, however deprecate the re-exports so folks know to upgrade sooner or later.
|
||||
#[deprecated(since = "0.30.0", note = "Please use crate::address")]
|
||||
pub mod address {
|
||||
pub use crate::address::*;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue