Merge #20466: test: Fix intermittent p2p_fingerprint issue

fad7be584ffaf8099cc099d9378ba831c9483260 test: Fix intermittent p2p_finerprint issue (MarcoFalke)

Pull request description:

  A single sync_with_ping can't be used to drop a block announcement, as the block might be sent *after* the ping has been responded to.

  Fix that by waiting for the block.

ACKs for top commit:
  theStack:
    ACK fad7be584ffaf8099cc099d9378ba831c9483260

Tree-SHA512: d43ba9d07273486858f65a26326cc6637ef743bf7b400e5048ba7eac266fb1893283e6503dd49f179caa1abab2977315fb70ba9fba34be9a817a74259d8e4034
This commit is contained in:
MarcoFalke 2020-12-03 10:09:23 +01:00 committed by PastaPastaPasta
parent 5783743f9f
commit d667e57dc6

View File

@ -118,7 +118,7 @@ class P2PFingerprintTest(BitcoinTestFramework):
block_hash = int(tip, 16) block_hash = int(tip, 16)
self.send_block_request(block_hash, node0) self.send_block_request(block_hash, node0)
self.send_header_request(block_hash, node0) self.send_header_request(block_hash, node0)
node0.sync_with_ping() node0.wait_for_block(block_hash, timeout=3)
# Request for very old stale block should now fail # Request for very old stale block should now fail
self.send_block_request(stale_hash, node0) self.send_block_request(stale_hash, node0)
@ -144,5 +144,6 @@ class P2PFingerprintTest(BitcoinTestFramework):
test_function = lambda: self.last_header_equals(block_hash, node0) test_function = lambda: self.last_header_equals(block_hash, node0)
wait_until(test_function, timeout=3) wait_until(test_function, timeout=3)
if __name__ == '__main__': if __name__ == '__main__':
P2PFingerprintTest().main() P2PFingerprintTest().main()