From 3a10d700bc1889b3690097efc935c5a4ba5966bb Mon Sep 17 00:00:00 2001 From: brunoerg Date: Tue, 14 Oct 2025 11:02:38 -0300 Subject: [PATCH] test: P2SH sig ops are only counted with `SCRIPT_VERIFY_P2SH` flag --- src/test/sigopcount_tests.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/sigopcount_tests.cpp b/src/test/sigopcount_tests.cpp index e33603129c2..41a4304fe0e 100644 --- a/src/test/sigopcount_tests.cpp +++ b/src/test/sigopcount_tests.cpp @@ -151,6 +151,9 @@ BOOST_AUTO_TEST_CASE(GetTxSigOpCost) BuildTxs(spendingTx, coins, creationTx, scriptPubKey, scriptSig, CScriptWitness()); assert(GetTransactionSigOpCost(CTransaction(spendingTx), coins, flags) == 2 * WITNESS_SCALE_FACTOR); assert(VerifyWithFlag(CTransaction(creationTx), spendingTx, flags) == SCRIPT_ERR_CHECKMULTISIGVERIFY); + + // P2SH sigops are not counted if we don't set the SCRIPT_VERIFY_P2SH flag + assert(GetTransactionSigOpCost(CTransaction(spendingTx), coins, /*flags=*/0) == 0); } // P2WPKH witness program