From aae03999a5ec0993a14c6fb145bcb690a6fb5c2e Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Fri, 3 Feb 2023 14:04:37 +1100 Subject: [PATCH] Do not export unusual hash types at crate root Currently we use a wildcard to export all the hash types in `hash_types`. We are moving to a world were we only export normal/standard types from the crate root. Remove the reexport of the following hash types: - `FilterHash` - `FilterHeader` - `TxMerkleNode` - `WitnessCommitment` - `WitnessMerkleNode` - `XpubIdentifier` - `Sighash` Fix: #1541 --- bitcoin/src/bip152.rs | 4 ++-- bitcoin/src/blockdata/transaction.rs | 3 ++- bitcoin/src/lib.rs | 2 +- bitcoin/src/sighash.rs | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bitcoin/src/bip152.rs b/bitcoin/src/bip152.rs index a8eacbb5..af99fad5 100644 --- a/bitcoin/src/bip152.rs +++ b/bitcoin/src/bip152.rs @@ -376,9 +376,9 @@ mod test { use crate::blockdata::locktime::absolute; use crate::consensus::encode::{deserialize, serialize}; use crate::hashes::hex::FromHex; + use crate::hash_types::TxMerkleNode; use crate::{ - CompactTarget, OutPoint, ScriptBuf, Sequence, Transaction, TxIn, TxMerkleNode, TxOut, Txid, - Witness, + CompactTarget, OutPoint, ScriptBuf, Sequence, Transaction, TxIn, TxOut, Txid, Witness, }; fn dummy_tx(nonce: &[u8]) -> Transaction { diff --git a/bitcoin/src/blockdata/transaction.rs b/bitcoin/src/blockdata/transaction.rs index 6a9bb334..620c41d3 100644 --- a/bitcoin/src/blockdata/transaction.rs +++ b/bitcoin/src/blockdata/transaction.rs @@ -568,7 +568,8 @@ impl EncodeSigningDataResult { /// /// ```rust /// # use bitcoin::consensus::deserialize; - /// # use bitcoin::{Transaction, Sighash}; + /// # use bitcoin::Transaction; + /// # use bitcoin::hash_types::Sighash; /// # use bitcoin_hashes::{Hash, hex::FromHex}; /// # let mut writer = Sighash::engine(); /// # let input_index = 0; diff --git a/bitcoin/src/lib.rs b/bitcoin/src/lib.rs index a5288cbb..e7d4f7c0 100644 --- a/bitcoin/src/lib.rs +++ b/bitcoin/src/lib.rs @@ -137,7 +137,7 @@ pub use crate::consensus::encode::VarInt; pub use crate::crypto::key::{self, PrivateKey, PublicKey}; pub use crate::crypto::{ecdsa, schnorr}; pub use crate::error::Error; -pub use crate::hash_types::*; +pub use crate::hash_types::{Txid, Wtxid, BlockHash, PubkeyHash, ScriptHash, WPubkeyHash, WScriptHash}; pub use crate::merkle_tree::MerkleBlock; pub use crate::network::constants::Network; pub use crate::pow::{CompactTarget, Target, Work}; diff --git a/bitcoin/src/sighash.rs b/bitcoin/src/sighash.rs index 39e4a1a3..74c7dcc3 100644 --- a/bitcoin/src/sighash.rs +++ b/bitcoin/src/sighash.rs @@ -12,12 +12,13 @@ use core::borrow::Borrow; use core::ops::{Deref, DerefMut}; use core::{fmt, str}; -use crate::{io, Script, ScriptBuf, Transaction, TxIn, TxOut, Sequence, Sighash}; +use crate::{io, Script, ScriptBuf, Transaction, TxIn, TxOut, Sequence}; use crate::blockdata::transaction::EncodeSigningDataResult; use crate::blockdata::witness::Witness; use crate::consensus::{encode, Encodable}; use crate::error::impl_std_error; use crate::hashes::{sha256, sha256d, Hash}; +use crate::hash_types::Sighash; use crate::prelude::*; use crate::taproot::{LeafVersion, TapLeafHash, TapSighashHash, TAPROOT_ANNEX_PREFIX};