Skip to content

Commit d1d538e

Browse files
committed
Merge rust-bitcoin#4167: bitcoin: Remove hash type re-exports
852bcf6 bitcoin: Remove hash type re-exports (Tobin C. Harding) Pull request description: The `{W}PubkeyHash` and `{W}ScriptHash` types are not likely to be used directly by consumers of the library because we have other function that return them and are more ergonomic to use. There is therefor no good reason to re-export them from the crate root. ACKs for top commit: apoelstra: ACK 852bcf6; successfully ran local tests; will one-ACK merge, still does not affect any public API Kixunil: ACK 852bcf6 Tree-SHA512: fbc4a7e3e116e962dc4b65b8681343e6ecd485a2289c5798979ce8e6ead4c0b6bda04ae33af1bdd711e852f95896107f9fa3c63d52fd36a6f802de4a7b677073
2 parents ed772d4 + 852bcf6 commit d1d538e

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

Diff for: bitcoin/examples/ecdsa-psbt-simple.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@ use std::collections::BTreeMap;
2626

2727
use bitcoin::address::script_pubkey::ScriptBufExt as _;
2828
use bitcoin::bip32::{ChildNumber, DerivationPath, Fingerprint, IntoDerivationPath, Xpriv, Xpub};
29+
use bitcoin::key::WPubkeyHash;
2930
use bitcoin::locktime::absolute;
3031
use bitcoin::psbt::Input;
3132
use bitcoin::secp256k1::{Secp256k1, Signing};
3233
use bitcoin::witness::WitnessExt as _;
3334
use bitcoin::{
3435
consensus, transaction, Address, Amount, EcdsaSighashType, Network, OutPoint, Psbt, ScriptBuf,
35-
Sequence, Transaction, TxIn, TxOut, Txid, WPubkeyHash, Witness,
36+
Sequence, Transaction, TxIn, TxOut, Txid, Witness,
3637
};
3738

3839
// The master xpriv, from which we derive the keys we control.

Diff for: bitcoin/examples/sign-tx-segwit-v0.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
//! Demonstrate creating a transaction that spends to and from p2wpkh outputs.
44
55
use bitcoin::address::script_pubkey::ScriptBufExt as _;
6+
use bitcoin::key::WPubkeyHash;
67
use bitcoin::locktime::absolute;
78
use bitcoin::secp256k1::{rand, Message, Secp256k1, SecretKey, Signing};
89
use bitcoin::sighash::{EcdsaSighashType, SighashCache};
910
use bitcoin::witness::WitnessExt as _;
1011
use bitcoin::{
1112
transaction, Address, Amount, Network, OutPoint, ScriptBuf, Sequence, Transaction, TxIn, TxOut,
12-
Txid, WPubkeyHash, Witness,
13+
Txid, Witness,
1314
};
1415

1516
const DUMMY_UTXO_AMOUNT: Amount = Amount::from_sat_unchecked(20_000_000);

Diff for: bitcoin/src/hash_types.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ pub use crate::{
1313
#[cfg(test)]
1414
mod tests {
1515
use super::*;
16-
use crate::{
17-
LegacySighash, PubkeyHash, ScriptHash, SegwitV0Sighash, TapSighash, WPubkeyHash,
18-
WScriptHash, XKeyIdentifier,
19-
};
16+
use crate::key::{PubkeyHash, WPubkeyHash};
17+
use crate::script::{ScriptHash, WScriptHash};
18+
use crate::{LegacySighash, SegwitV0Sighash, TapSighash, XKeyIdentifier};
2019

2120
#[rustfmt::skip]
2221
/// sha256d of the empty string

Diff for: bitcoin/src/lib.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,7 @@ pub use crate::{
143143
bip158::{FilterHash, FilterHeader},
144144
bip32::XKeyIdentifier,
145145
crypto::ecdsa,
146-
crypto::key::{
147-
self, CompressedPublicKey, PrivateKey, PubkeyHash, PublicKey, WPubkeyHash, XOnlyPublicKey,
148-
},
146+
crypto::key::{self, CompressedPublicKey, PrivateKey, PublicKey, XOnlyPublicKey},
149147
crypto::sighash::{self, LegacySighash, SegwitV0Sighash, TapSighash, TapSighashTag},
150148
merkle_tree::MerkleBlock,
151149
network::params::{self, Params},
@@ -163,7 +161,6 @@ pub use crate::{
163161
blockdata::opcodes::{self, Opcode},
164162
blockdata::script::witness_program::{self, WitnessProgram},
165163
blockdata::script::witness_version::{self, WitnessVersion},
166-
blockdata::script::{ScriptHash, WScriptHash}, // TODO: Move these down below after they are in primitives.
167164
// These modules also re-export all the respective `primitives` types.
168165
blockdata::{
169166
block, constants, fee_rate, locktime, script, transaction, weight, witness,

0 commit comments

Comments
 (0)