| 1911 | } |
| 1912 | |
| 1913 | static bool VerifyTaprootCommitment(const std::vector<unsigned char>& control, const std::vector<unsigned char>& program, const uint256& tapleaf_hash) |
| 1914 | { |
| 1915 | assert(control.size() >= TAPROOT_CONTROL_BASE_SIZE); |
| 1916 | assert(program.size() >= uint256::size()); |
| 1917 | //! The internal pubkey (x-only, so no Y coordinate parity). |
| 1918 | const XOnlyPubKey p{std::span{control}.subspan(1, TAPROOT_CONTROL_BASE_SIZE - 1)}; |
| 1919 | //! The output pubkey (taken from the scriptPubKey). |
| 1920 | const XOnlyPubKey q{program}; |
| 1921 | // Compute the Merkle root from the leaf and the provided path. |
| 1922 | const uint256 merkle_root = ComputeTaprootMerkleRoot(control, tapleaf_hash); |
| 1923 | // Verify that the output pubkey matches the tweaked internal pubkey, after correcting for parity. |
| 1924 | return q.CheckTapTweak(p, merkle_root, control[0] & 1); |
| 1925 | } |
| 1926 | |
| 1927 | static bool VerifyWitnessProgram(const CScriptWitness& witness, int witversion, const std::vector<unsigned char>& program, script_verify_flags flags, const BaseSignatureChecker& checker, ScriptError* serror, bool is_p2sh) |
| 1928 | { |
no test coverage detected