| 222 | static const CHashWriter HASHER_TAPTWEAK_ELEMENTS = TaggedHash("TapTweak/elements"); |
| 223 | |
| 224 | uint256 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 | |
| 235 | bool XOnlyPubKey::CheckTapTweak(const XOnlyPubKey& internal, const uint256& merkle_root, bool parity) const |
| 236 | { |
no test coverage detected