diff --git a/test/functional/p2p_segwit.py b/test/functional/p2p_segwit.py index 92b69e49970..0917e1dc2a7 100755 --- a/test/functional/p2p_segwit.py +++ b/test/functional/p2p_segwit.py @@ -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))