mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-11 21:20:39 +02:00
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:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user