Skip to content

Commit

Permalink
bitcoin: Remove hash type re-exports
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tcharding committed Mar 3, 2025
1 parent 5bc08b1 commit 1eba55f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
3 changes: 2 additions & 1 deletion bitcoin/examples/ecdsa-psbt-simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ use std::collections::BTreeMap;

use bitcoin::address::script_pubkey::ScriptBufExt as _;
use bitcoin::bip32::{ChildNumber, DerivationPath, Fingerprint, IntoDerivationPath, Xpriv, Xpub};
use bitcoin::key::WPubkeyHash;
use bitcoin::locktime::absolute;
use bitcoin::psbt::Input;
use bitcoin::secp256k1::{Secp256k1, Signing};
use bitcoin::witness::WitnessExt as _;
use bitcoin::{
consensus, transaction, Address, Amount, EcdsaSighashType, Network, OutPoint, Psbt, ScriptBuf,
Sequence, Transaction, TxIn, TxOut, Txid, WPubkeyHash, Witness,
Sequence, Transaction, TxIn, TxOut, Txid, Witness,
};

// The master xpriv, from which we derive the keys we control.
Expand Down
7 changes: 3 additions & 4 deletions bitcoin/src/hash_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ pub use crate::{
#[cfg(test)]
mod tests {
use super::*;
use crate::{
LegacySighash, PubkeyHash, ScriptHash, SegwitV0Sighash, TapSighash, WPubkeyHash,
WScriptHash, XKeyIdentifier,
};
use crate::key::{PubkeyHash, WPubkeyHash};
use crate::script::{ScriptHash, WScriptHash};
use crate::{LegacySighash, SegwitV0Sighash, TapSighash, XKeyIdentifier};

#[rustfmt::skip]
/// sha256d of the empty string
Expand Down
5 changes: 1 addition & 4 deletions bitcoin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ pub use crate::{
bip158::{FilterHash, FilterHeader},
bip32::XKeyIdentifier,
crypto::ecdsa,
crypto::key::{
self, CompressedPublicKey, PrivateKey, PubkeyHash, PublicKey, WPubkeyHash, XOnlyPublicKey,
},
crypto::key::{self, CompressedPublicKey, PrivateKey, PublicKey, XOnlyPublicKey},
crypto::sighash::{self, LegacySighash, SegwitV0Sighash, TapSighash, TapSighashTag},
merkle_tree::MerkleBlock,
network::params::{self, Params},
Expand All @@ -163,7 +161,6 @@ pub use crate::{
blockdata::locktime::{absolute, relative},
blockdata::script::witness_program::{self, WitnessProgram},
blockdata::script::witness_version::{self, WitnessVersion},
blockdata::script::{ScriptHash, WScriptHash}, // TODO: Move these down below after they are in primitives.
// These modules also re-export all the respective `primitives` types.
blockdata::{
block, constants, fee_rate, locktime, opcodes, script, transaction, weight, witness,
Expand Down

0 comments on commit 1eba55f

Please sign in to comment.