Skip to content

Commit 6e5f941

Browse files
committed
Remove sha256t_hash_newtype macro
Since commit `commit 275adc6c335a4326699cfbd444949e1725864ea1` on `bitcoin_hashes` we have the identical implementation of the macro `sha256t1_hash_newtype` in this crate and in `bitcoin_hashes`. Remove the `sha256t_hash_newtype` macro from this crate in favour of the one in `bitcoin_hashes`.
1 parent bb495a2 commit 6e5f941

File tree

1 file changed

+5
-29
lines changed

1 file changed

+5
-29
lines changed

src/util/taproot.rs

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use core::cmp::Reverse;
2525
#[cfg(feature = "std")]
2626
use std::error;
2727

28-
use crate::hashes::{sha256, sha256t, Hash, HashEngine};
28+
use crate::hashes::{sha256, Hash, HashEngine};
2929
use crate::schnorr::{TweakedPublicKey, UntweakedPublicKey, TapTweak};
3030
use crate::util::key::XOnlyPublicKey;
3131
use crate::Script;
@@ -60,41 +60,17 @@ const MIDSTATE_TAPSIGHASH: [u8; 32] = [
6060
];
6161
// f504a425d7f8783b1363868ae3e556586eee945dbc7888dd02a6e2c31873fe9f
6262

63-
/// Internal macro to speficy the different taproot tagged hashes.
64-
macro_rules! sha256t_hash_newtype {
65-
($newtype:ident, $tag:ident, $midstate:ident, $midstate_len:expr, $docs:meta, $reverse: expr) => {
66-
sha256t_hash_newtype!($newtype, $tag, $midstate, $midstate_len, $docs, $reverse, stringify!($newtype));
67-
};
68-
69-
($newtype:ident, $tag:ident, $midstate:ident, $midstate_len:expr, $docs:meta, $reverse: expr, $sname:expr) => {
70-
#[doc = "The tag used for ["]
71-
#[doc = $sname]
72-
#[doc = "]"]
73-
#[derive(Copy, Clone, PartialEq, Eq, Default, PartialOrd, Ord, Hash)]
74-
pub struct $tag;
75-
76-
impl sha256t::Tag for $tag {
77-
fn engine() -> sha256::HashEngine {
78-
let midstate = sha256::Midstate::from_inner($midstate);
79-
sha256::HashEngine::from_midstate(midstate, $midstate_len)
80-
}
81-
}
82-
83-
hash_newtype!($newtype, sha256t::Hash<$tag>, 32, $docs, $reverse);
84-
};
85-
}
86-
8763
// Taproot test vectors from BIP-341 state the hashes without any reversing
88-
sha256t_hash_newtype!(TapLeafHash, TapLeafTag, MIDSTATE_TAPLEAF, 64,
64+
hashes::sha256t_hash_newtype!(TapLeafHash, TapLeafTag, MIDSTATE_TAPLEAF, 64,
8965
doc="Taproot-tagged hash for tapscript Merkle tree leafs", false
9066
);
91-
sha256t_hash_newtype!(TapBranchHash, TapBranchTag, MIDSTATE_TAPBRANCH, 64,
67+
hashes::sha256t_hash_newtype!(TapBranchHash, TapBranchTag, MIDSTATE_TAPBRANCH, 64,
9268
doc="Taproot-tagged hash for tapscript Merkle tree branches", false
9369
);
94-
sha256t_hash_newtype!(TapTweakHash, TapTweakTag, MIDSTATE_TAPTWEAK, 64,
70+
hashes::sha256t_hash_newtype!(TapTweakHash, TapTweakTag, MIDSTATE_TAPTWEAK, 64,
9571
doc="Taproot-tagged hash for public key tweaks", false
9672
);
97-
sha256t_hash_newtype!(TapSighashHash, TapSighashTag, MIDSTATE_TAPSIGHASH, 64,
73+
hashes::sha256t_hash_newtype!(TapSighashHash, TapSighashTag, MIDSTATE_TAPSIGHASH, 64,
9874
doc="Taproot-tagged hash for the taproot signature hash", false
9975
);
10076

0 commit comments

Comments
 (0)