Skip to content

Commit

Permalink
qa: Avoid race in p2p_invalid_block by waiting for the block request
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoFalke committed Nov 9, 2018
1 parent 6c787d3 commit fa21568
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/functional/p2p_invalid_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ def run_test(self):
block2.vtx.append(tx2)
assert_equal(block2.hashMerkleRoot, block2.calc_merkle_root())
assert_equal(orig_hash, block2.rehash())
assert(block2_orig.vtx != block2.vtx)
assert block2_orig.vtx != block2.vtx

node.p2p.send_blocks_and_test([block2], node, success=False, request_block=False, reject_reason='bad-txns-duplicate')
node.p2p.send_blocks_and_test([block2], node, success=False, reject_reason='bad-txns-duplicate')

# Check transactions for duplicate inputs
self.log.info("Test duplicate input block.")
Expand All @@ -89,7 +89,7 @@ def run_test(self):
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='bad-txns-inputs-duplicate')
node.p2p.send_blocks_and_test([block2_orig], node, success=False, reject_reason='bad-txns-inputs-duplicate')

self.log.info("Test very broken block.")

Expand All @@ -102,7 +102,8 @@ def run_test(self):
block3.rehash()
block3.solve()

node.p2p.send_blocks_and_test([block3], node, success=False, request_block=False, reject_reason='bad-cb-amount')
node.p2p.send_blocks_and_test([block3], node, success=False, reject_reason='bad-cb-amount')


if __name__ == '__main__':
InvalidBlockRequestTest().main()

0 comments on commit fa21568

Please sign in to comment.