Skip to content

Commit 15fea9f

Browse files
brunoergRaimo33
authored andcommitted
test: P2SH sig ops are only counted with SCRIPT_VERIFY_P2SH flag
1 parent 76dbc48 commit 15fea9f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/test/sigopcount_tests.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ BOOST_AUTO_TEST_CASE(GetTxSigOpCost)
151151
BuildTxs(spendingTx, coins, creationTx, scriptPubKey, scriptSig, CScriptWitness());
152152
assert(GetTransactionSigOpCost(CTransaction(spendingTx), coins, flags) == 2 * WITNESS_SCALE_FACTOR);
153153
assert(VerifyWithFlag(CTransaction(creationTx), spendingTx, flags) == SCRIPT_ERR_CHECKMULTISIGVERIFY);
154+
155+
// P2SH sigops are not counted if we don't set the SCRIPT_VERIFY_P2SH flag
156+
assert(GetTransactionSigOpCost(CTransaction(spendingTx), coins, /*flags=*/0) == 0);
154157
}
155158

156159
// P2WPKH witness program

0 commit comments

Comments
 (0)