| 207 | }; |
| 208 | |
| 209 | void run_verify_test( |
| 210 | const ScriptPubkey& spent_script_pubkey, |
| 211 | const Transaction& spending_tx, |
| 212 | const PrecomputedTransactionData* precomputed_txdata, |
| 213 | int64_t amount, |
| 214 | unsigned int input_index, |
| 215 | bool taproot) |
| 216 | { |
| 217 | auto status = ScriptVerifyStatus::OK; |
| 218 | |
| 219 | if (taproot) { |
| 220 | BOOST_CHECK(spent_script_pubkey.Verify( |
| 221 | amount, |
| 222 | spending_tx, |
| 223 | precomputed_txdata, |
| 224 | input_index, |
| 225 | ScriptVerificationFlags::ALL, |
| 226 | status)); |
| 227 | BOOST_CHECK(status == ScriptVerifyStatus::OK); |
| 228 | } else { |
| 229 | BOOST_CHECK(!spent_script_pubkey.Verify( |
| 230 | amount, |
| 231 | spending_tx, |
| 232 | precomputed_txdata, |
| 233 | input_index, |
| 234 | ScriptVerificationFlags::ALL, |
| 235 | status)); |
| 236 | BOOST_CHECK(status == ScriptVerifyStatus::ERROR_SPENT_OUTPUTS_REQUIRED); |
| 237 | } |
| 238 | |
| 239 | BOOST_CHECK(spent_script_pubkey.Verify( |
| 240 | amount, |
| 241 | spending_tx, |
| 242 | precomputed_txdata, |
| 243 | input_index, |
| 244 | VERIFY_ALL_PRE_TAPROOT, |
| 245 | status)); |
| 246 | BOOST_CHECK(status == ScriptVerifyStatus::OK); |
| 247 | |
| 248 | BOOST_CHECK(spent_script_pubkey.Verify( |
| 249 | 0, |
| 250 | spending_tx, |
| 251 | precomputed_txdata, |
| 252 | input_index, |
| 253 | VERIFY_ALL_PRE_SEGWIT, |
| 254 | status)); |
| 255 | BOOST_CHECK(status == ScriptVerifyStatus::OK); |
| 256 | } |
| 257 | |
| 258 | template <typename T> |
| 259 | concept HasToBytes = requires(T t) { |
no test coverage detected