qa: Avoid race in p2p_invalid_block by waiting for the block request

Github-Pull: #14700
Rebased-From: fa21568208
This commit is contained in:
MarcoFalke 2018-11-09 15:58:19 -05:00 committed by fanquake
parent 79358817e5
commit f9db08e8ca
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1

View file

@ -80,9 +80,9 @@ class InvalidBlockRequestTest(BitcoinTestFramework):
block2.vtx.append(tx2) block2.vtx.append(tx2)
assert_equal(block2.hashMerkleRoot, block2.calc_merkle_root()) assert_equal(block2.hashMerkleRoot, block2.calc_merkle_root())
assert_equal(orig_hash, block2.rehash()) 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_code=16, reject_reason=b'bad-txns-duplicate') node.p2p.send_blocks_and_test([block2], node, success=False, reject_code=16, reject_reason=b'bad-txns-duplicate')
# Check transactions for duplicate inputs # Check transactions for duplicate inputs
self.log.info("Test duplicate input block.") self.log.info("Test duplicate input block.")
@ -92,7 +92,7 @@ class InvalidBlockRequestTest(BitcoinTestFramework):
block2_orig.hashMerkleRoot = block2_orig.calc_merkle_root() block2_orig.hashMerkleRoot = block2_orig.calc_merkle_root()
block2_orig.rehash() block2_orig.rehash()
block2_orig.solve() block2_orig.solve()
node.p2p.send_blocks_and_test([block2_orig], node, success=False, request_block=False, reject_reason=b'bad-txns-inputs-duplicate') node.p2p.send_blocks_and_test([block2_orig], node, success=False, reject_reason=b'bad-txns-inputs-duplicate')
self.log.info("Test very broken block.") self.log.info("Test very broken block.")
@ -105,7 +105,7 @@ class InvalidBlockRequestTest(BitcoinTestFramework):
block3.rehash() block3.rehash()
block3.solve() block3.solve()
node.p2p.send_blocks_and_test([block3], node, success=False, request_block=False, reject_code=16, reject_reason=b'bad-cb-amount') node.p2p.send_blocks_and_test([block3], node, success=False, reject_code=16, reject_reason=b'bad-cb-amount')
if __name__ == '__main__': if __name__ == '__main__':
InvalidBlockRequestTest().main() InvalidBlockRequestTest().main()