| 244 | static const HashWriter HASHER_TAPTWEAK{TaggedHash("TapTweak")}; |
| 245 | |
| 246 | uint256 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 | |
| 257 | bool XOnlyPubKey::CheckTapTweak(const XOnlyPubKey& internal, const uint256& merkle_root, bool parity) const |
| 258 | { |