test: P2SH sig ops are only counted with SCRIPT_VERIFY_P2SH flag

This commit is contained in:
brunoerg
2025-10-14 11:02:38 -03:00
parent b510893d00
commit 3a10d700bc

View File

@@ -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