MCPcopy Create free account
hub / github.com/ElementsProject/elements / ComputeTapTweakHash

Method ComputeTapTweakHash

src/pubkey.cpp:224–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222static const CHashWriter HASHER_TAPTWEAK_ELEMENTS = TaggedHash("TapTweak/elements");
223
224uint256 XOnlyPubKey::ComputeTapTweakHash(const uint256* merkle_root) const
225{
226 if (merkle_root == nullptr) {
227 // We have no scripts. The actual tweak does not matter, but follow BIP341 here to
228 // allow for reproducible tweaking.
229 return (CHashWriter(HASHER_TAPTWEAK_ELEMENTS) << m_keydata).GetSHA256();
230 } else {
231 return (CHashWriter(HASHER_TAPTWEAK_ELEMENTS) << m_keydata << *merkle_root).GetSHA256();
232 }
233}
234
235bool XOnlyPubKey::CheckTapTweak(const XOnlyPubKey& internal, const uint256& merkle_root, bool parity) const
236{

Callers 2

CheckTapTweakMethod · 0.80
SignSchnorrMethod · 0.80

Calls 2

CHashWriterClass · 0.85
GetSHA256Method · 0.80

Tested by

no test coverage detected