Skip to content

Commit 686e97a

Browse files
author
MarcoFalke
committed
Merge #13522: [tests] Fix p2p_sendheaders race
75848bc [tests] Fix p2p_sendheaders race (John Newbery) Pull request description: p2p_sendheaders has a race in part 1.3. part 1.2 sends a block to the node over the 'test_node' connection, but doesn't wait for an inv to be received on the 'inv_node' connection. If we get to part 1.3 before that inv has been received, then the subsequent call to check_last_inv_announcement could fail. Tree-SHA512: ba9baffb3a9c0d379259190c737a7a4ad2e1133005a5b026af4f6b67a2978e24db39289551ad29134151879593ef5472be7e569a3557c0740fb51f5c56263d9a
2 parents 954f4a9 + 75848bc commit 686e97a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

test/functional/p2p_sendheaders.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ def test_nonnull_locators(self, test_node, inv_node):
301301
test_node.clear_block_announcements() # since we requested headers...
302302
elif i == 2:
303303
# this time announce own block via headers
304+
inv_node.clear_block_announcements()
304305
height = self.nodes[0].getblockcount()
305306
last_time = self.nodes[0].getblock(self.nodes[0].getbestblockhash())['time']
306307
block_time = last_time + 1
@@ -310,6 +311,7 @@ def test_nonnull_locators(self, test_node, inv_node):
310311
test_node.wait_for_getdata([new_block.sha256])
311312
test_node.send_message(msg_block(new_block))
312313
test_node.sync_with_ping() # make sure this block is processed
314+
wait_until(lambda: inv_node.block_announced, timeout=60, lock=mininode_lock)
313315
inv_node.clear_block_announcements()
314316
test_node.clear_block_announcements()
315317

0 commit comments

Comments
 (0)