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