aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2018-09-17 16:15:02 -0400
committerMatt Corallo <git@bluematt.me>2018-09-17 16:15:18 -0400
commit0d49c82edd4c2c92f8ebe215c057b0173a258d77 (patch)
tree0d362c45d95f5cfe40116dac54c30472559cfddb
parent833180f538c7fa16b097022c7c0d4b4d2f09688b (diff)
[qa] backport: Test for duplicate inputs within a transaction
-rwxr-xr-xtest/functional/p2p_invalid_block.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/functional/p2p_invalid_block.py b/test/functional/p2p_invalid_block.py
index e910bedd09..1534f362e3 100755
--- a/test/functional/p2p_invalid_block.py
+++ b/test/functional/p2p_invalid_block.py
@@ -81,6 +81,16 @@ class InvalidBlockRequestTest(BitcoinTestFramework):
node.p2p.send_blocks_and_test([block2], node, False, False, 16, b'bad-txns-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)