diff --git a/src/blockdata/script.rs b/src/blockdata/script.rs index 8ae8e525..71738974 100644 --- a/src/blockdata/script.rs +++ b/src/blockdata/script.rs @@ -998,7 +998,7 @@ impl<'de> serde::Deserialize<'de> for Script { D: serde::Deserializer<'de>, { use core::fmt::Formatter; - use hashes::hex::FromHex; + use crate::hashes::hex::FromHex; if deserializer.is_human_readable() { diff --git a/src/blockdata/witness.rs b/src/blockdata/witness.rs index c93ebf00..9b16e647 100644 --- a/src/blockdata/witness.rs +++ b/src/blockdata/witness.rs @@ -281,7 +281,7 @@ impl serde::Serialize for Witness { where S: serde::Serializer, { - use hashes::hex::ToHex; + use crate::hashes::hex::ToHex; use serde::ser::SerializeSeq; let human_readable = serializer.is_human_readable(); @@ -315,8 +315,8 @@ impl<'de> serde::Deserialize<'de> for Witness { fn visit_seq>(self, mut a: A) -> Result { - use hashes::hex::FromHex; - use hashes::hex::Error::*; + use crate::hashes::hex::FromHex; + use crate::hashes::hex::Error::*; use serde::de::{self, Unexpected}; let mut ret = match a.size_hint() { diff --git a/src/lib.rs b/src/lib.rs index 1b51b952..382879ae 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -63,8 +63,7 @@ extern crate alloc; extern crate core2; // Re-exported dependencies. -#[macro_use] -pub extern crate bitcoin_hashes as hashes; +pub use bitcoin_hashes as hashes; pub extern crate bech32; pub extern crate secp256k1; diff --git a/src/serde_utils.rs b/src/serde_utils.rs index f995cb99..a25bac7d 100644 --- a/src/serde_utils.rs +++ b/src/serde_utils.rs @@ -235,7 +235,7 @@ pub mod hex_bytes { //! Module for serialization of byte arrays as hex strings. #![allow(missing_docs)] - use hashes::hex::{FromHex, ToHex}; + use crate::hashes::hex::{FromHex, ToHex}; use serde; pub fn serialize(bytes: &T, s: S) -> Result diff --git a/src/util/psbt/mod.rs b/src/util/psbt/mod.rs index 4bfdd7e2..334b8b4a 100644 --- a/src/util/psbt/mod.rs +++ b/src/util/psbt/mod.rs @@ -492,7 +492,7 @@ mod tests { #[test] fn test_serde_psbt() { //! Create a full PSBT value with various fields filled and make sure it can be JSONized. - use hashes::sha256d; + use crate::hashes::sha256d; use crate::util::psbt::map::Input; use crate::EcdsaSighashType; diff --git a/src/util/taproot.rs b/src/util/taproot.rs index 8a3b776d..e52f9a20 100644 --- a/src/util/taproot.rs +++ b/src/util/taproot.rs @@ -13,7 +13,7 @@ use core::convert::TryFrom; use core::fmt; use core::cmp::Reverse; -use crate::hashes::{sha256, Hash, HashEngine}; +use crate::hashes::{sha256, sha256t_hash_newtype, Hash, HashEngine}; use crate::schnorr::{TweakedPublicKey, UntweakedPublicKey, TapTweak}; use crate::util::key::XOnlyPublicKey; use crate::Script; @@ -49,16 +49,16 @@ const MIDSTATE_TAPSIGHASH: [u8; 32] = [ // f504a425d7f8783b1363868ae3e556586eee945dbc7888dd02a6e2c31873fe9f // Taproot test vectors from BIP-341 state the hashes without any reversing -hashes::sha256t_hash_newtype!(TapLeafHash, TapLeafTag, MIDSTATE_TAPLEAF, 64, +sha256t_hash_newtype!(TapLeafHash, TapLeafTag, MIDSTATE_TAPLEAF, 64, doc="Taproot-tagged hash for tapscript Merkle tree leafs", false ); -hashes::sha256t_hash_newtype!(TapBranchHash, TapBranchTag, MIDSTATE_TAPBRANCH, 64, +sha256t_hash_newtype!(TapBranchHash, TapBranchTag, MIDSTATE_TAPBRANCH, 64, doc="Taproot-tagged hash for tapscript Merkle tree branches", false ); -hashes::sha256t_hash_newtype!(TapTweakHash, TapTweakTag, MIDSTATE_TAPTWEAK, 64, +sha256t_hash_newtype!(TapTweakHash, TapTweakTag, MIDSTATE_TAPTWEAK, 64, doc="Taproot-tagged hash for public key tweaks", false ); -hashes::sha256t_hash_newtype!(TapSighashHash, TapSighashTag, MIDSTATE_TAPSIGHASH, 64, +sha256t_hash_newtype!(TapSighashHash, TapSighashTag, MIDSTATE_TAPSIGHASH, 64, doc="Taproot-tagged hash for the taproot signature hash", false );