Skip to content

Commit

Permalink
[qa] backport: Test for duplicate inputs within a transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
sdaftuar authored and TheBlueMatt committed Sep 17, 2018
1 parent d1dee20 commit 9bd08fd
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/functional/p2p_invalid_block.py
Expand Up @@ -95,7 +95,18 @@ def get_tests(self):
assert(block2_orig.vtx != block2.vtx)

self.tip = block2.sha256
yield TestInstance([[block2, RejectResult(16, b'bad-txns-duplicate')], [block2_orig, True]])
yield TestInstance([[block2, RejectResult(16, b'bad-txns-duplicate')]])

# Check transactions for duplicate inputs
self.log.info("Test duplicate input block.")

block2_dup = copy.deepcopy(block2_orig)
block2_dup.vtx[2].vin.append(block2_dup.vtx[2].vin[0])
block2_dup.vtx[2].rehash()
block2_dup.hashMerkleRoot = block2_dup.calc_merkle_root()
block2_dup.rehash()
block2_dup.solve()
yield TestInstance([[block2_dup, RejectResult(16, b'bad-txns-inputs-duplicate')], [block2_orig, True]])
height += 1

'''
Expand Down

0 comments on commit 9bd08fd

Please sign in to comment.