| 3271 | } |
| 3272 | |
| 3273 | static bool VerifyTaprootCommitment(const std::vector<unsigned char>& control, const std::vector<unsigned char>& program, const uint256& tapleaf_hash) |
| 3274 | { |
| 3275 | assert(control.size() >= TAPROOT_CONTROL_BASE_SIZE); |
| 3276 | assert(program.size() >= uint256::size()); |
| 3277 | //! The internal pubkey (x-only, so no Y coordinate parity). |
| 3278 | const XOnlyPubKey p{Span{control}.subspan(1, TAPROOT_CONTROL_BASE_SIZE - 1)}; |
| 3279 | //! The output pubkey (taken from the scriptPubKey). |
| 3280 | const XOnlyPubKey q{program}; |
| 3281 | // Compute the Merkle root from the leaf and the provided path. |
| 3282 | const uint256 merkle_root = ComputeTaprootMerkleRoot(control, tapleaf_hash); |
| 3283 | // Verify that the output pubkey matches the tweaked internal pubkey, after correcting for parity. |
| 3284 | return q.CheckTapTweak(p, merkle_root, control[0] & 1); |
| 3285 | } |
| 3286 | |
| 3287 | static bool VerifyWitnessProgram(const CScriptWitness& witness, int witversion, const std::vector<unsigned char>& program, unsigned int flags, const BaseSignatureChecker& checker, ScriptError* serror, bool is_p2sh) |
| 3288 | { |
no test coverage detected