Skip to content

Commit 852bcf6

Browse files
committed
bitcoin: Remove hash type re-exports
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.
1 parent 5bc08b1 commit 852bcf6

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

bitcoin/examples/ecdsa-psbt-simple.rs

Lines changed: 2 additions & 1 deletion
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.

bitcoin/examples/sign-tx-segwit-v0.rs

Lines changed: 2 additions & 1 deletion
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);

bitcoin/src/hash_types.rs

Lines changed: 3 additions & 4 deletions
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

bitcoin/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,7 @@ pub use crate::{
144144
bip158::{FilterHash, FilterHeader},
145145
bip32::XKeyIdentifier,
146146
crypto::ecdsa,
147-
crypto::key::{
148-
self, CompressedPublicKey, PrivateKey, PubkeyHash, PublicKey, WPubkeyHash, XOnlyPublicKey,
149-
},
147+
crypto::key::{self, CompressedPublicKey, PrivateKey, PublicKey, XOnlyPublicKey},
150148
crypto::sighash::{self, LegacySighash, SegwitV0Sighash, TapSighash, TapSighashTag},
151149
merkle_tree::MerkleBlock,
152150
network::params::{self, Params},
@@ -163,7 +161,6 @@ pub use crate::{
163161
blockdata::locktime::{absolute, relative},
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, opcodes, script, transaction, weight, witness,

0 commit comments

Comments
 (0)