From 826219f99c27ee2c74471ab2d29f7e58f4c58c62 Mon Sep 17 00:00:00 2001 From: Suhas Daftuar Date: Mon, 17 Sep 2018 16:15:02 -0400 Subject: [PATCH] [qa] backport: Test for duplicate inputs within a transaction --- test/functional/p2p_invalid_block.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/functional/p2p_invalid_block.py b/test/functional/p2p_invalid_block.py index 905534b86..2e428f887 100755 --- a/test/functional/p2p_invalid_block.py +++ b/test/functional/p2p_invalid_block.py @@ -93,6 +93,16 @@ class InvalidBlockRequestTest(BitcoinTestFramework): block2_dup.solve() node.p2p.send_blocks_and_test([block2_dup], node, success=False, reject_reason='bad-txns-inputs-duplicate') + # Check transactions for duplicate inputs + self.log.info("Test duplicate input block.") + + block2_orig.vtx[2].vin.append(block2_orig.vtx[2].vin[0]) + block2_orig.vtx[2].rehash() + block2_orig.hashMerkleRoot = block2_orig.calc_merkle_root() + block2_orig.rehash() + block2_orig.solve() + node.p2p.send_blocks_and_test([block2_orig], node, success=False, request_block=False, reject_reason=b'bad-txns-inputs-duplicate') + self.log.info("Test very broken block.") block3 = create_block(tip, create_coinbase(height), block_time)