MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ComputeTapTweakHash

Method ComputeTapTweakHash

src/pubkey.cpp:246–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244static const HashWriter HASHER_TAPTWEAK{TaggedHash("TapTweak")};
245
246uint256 XOnlyPubKey::ComputeTapTweakHash(const uint256* merkle_root) const
247{
248 if (merkle_root == nullptr) {
249 // We have no scripts. The actual tweak does not matter, but follow BIP341 here to
250 // allow for reproducible tweaking.
251 return (HashWriter{HASHER_TAPTWEAK} << m_keydata).GetSHA256();
252 } else {
253 return (HashWriter{HASHER_TAPTWEAK} << m_keydata << *merkle_root).GetSHA256();
254 }
255}
256
257bool XOnlyPubKey::CheckTapTweak(const XOnlyPubKey& internal, const uint256& merkle_root, bool parity) const
258{

Callers 5

CheckTapTweakMethod · 0.80
KeyPairMethod · 0.80
SignMuSig2Function · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80

Calls 1

GetSHA256Method · 0.80

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.64
BOOST_AUTO_TEST_CASEFunction · 0.64