test: add mixed P2SH/witness sigop accounting

Add test covering transactions containing both
P2SH and witness inputs when enforcing the block sigop limit.
This commit is contained in:
Lőrinc
2026-07-23 19:06:18 -07:00
committed by Musa Haruna
parent 6e60c362bc
commit d180b891a2

View File

@@ -1955,6 +1955,14 @@ class SegWitTest(BitcoinTestFramework):
self.update_witness_block_with_transactions(block_6, [p2sh_tx])
test_witness_block(self.nodes[0], self.test_node, block_6, accepted=False, reason='bad-blk-sigops')
# Add witness data to verify that the transaction's P2SH sigops are still counted.
p2sh_tx.vin.append(CTxIn(COutPoint(tx.txid_int, outputs - 2), b""))
p2sh_tx.wit.vtxinwit = [CTxInWitness() for _ in p2sh_tx.vin]
p2sh_tx.wit.vtxinwit[-1].scriptWitness.stack = [witness_script_toomany]
block_7 = self.build_next_block()
self.update_witness_block_with_transactions(block_7, [p2sh_tx])
test_witness_block(self.nodes[0], self.test_node, block_7, accepted=False, reason='bad-blk-sigops')
# Cleanup and prep for next test
self.utxo.pop(0)
self.utxo.append(UTXO(tx2.txid_int, 0, tx2.vout[0].nValue))