From 198b36bc85d54792af82ea9b9e58554608573cb6 Mon Sep 17 00:00:00 2001 From: Sebastian Falbesoner Date: Sun, 7 Jun 2026 01:58:34 +0200 Subject: [PATCH] test: respect "TAPROOT requires WITNESS" rule in `ValidateCheckInputsForAllFlags` This is preparatory for the next commit, which introduces Taproot spends that would fail without this rule being enforced. While touching the function, also remove an outdated comment that refers to a parameter that doesn't exist anymore (`upgraded_nop` was removed in commit 01013f5d2fbe3fa86565c927bf7bb8ec0f525073, PR #10699). --- src/test/txvalidationcache_tests.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/test/txvalidationcache_tests.cpp b/src/test/txvalidationcache_tests.cpp index 5ace00880a6..dd636027943 100644 --- a/src/test/txvalidationcache_tests.cpp +++ b/src/test/txvalidationcache_tests.cpp @@ -114,8 +114,6 @@ BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, Dersig100Setup) // CHECKLOCKTIMEVERIFY (or CHECKSEQUENCEVERIFY), but the script does contain // OP_CHECKLOCKTIMEVERIFY (or OP_CHECKSEQUENCEVERIFY), then script execution // should fail. -// Capture this interaction with the upgraded_nop argument: set it when evaluating -// any script flag that is implemented as an upgraded NOP code. static void ValidateCheckInputsForAllFlags(const CTransaction &tx, script_verify_flags failing_flags, bool add_to_cache, CCoinsViewCache& active_coins_tip, ValidationCache& validation_cache) EXCLUSIVE_LOCKS_REQUIRED(::cs_main) { PrecomputedTransactionData txdata; @@ -134,6 +132,10 @@ static void ValidateCheckInputsForAllFlags(const CTransaction &tx, script_verify // script/interpreter.cpp test_flags |= SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_WITNESS; } + if ((test_flags & SCRIPT_VERIFY_TAPROOT)) { + // TAPROOT requires WITNESS + test_flags |= SCRIPT_VERIFY_WITNESS; + } if ((test_flags & SCRIPT_VERIFY_WITNESS)) { // WITNESS requires P2SH test_flags |= SCRIPT_VERIFY_P2SH;