Skip to content

Commit b3343d7

Browse files
MacroFakePastaPastaPasta
authored andcommitted
Merge bitcoin#25124: test: Fix intermittent race in p2p_unrequested_blocks.py
faac67c test: Fix intermittent race in p2p_unrequested_blocks.py (MacroFake) Pull request description: Disconnect may also result in an `OSError`, not only an `AssertionError`. Instead of maintaining a dead code path and enumerating disconnect reasons, just assume disconnection happens every time. ACKs for top commit: jamesob: Code review ACK bitcoin@faac67c Tree-SHA512: d2cec003168e421a5faed275cb2e1ef9fc63f9e8514f41d21da17e8964c79e5b453ccd72cd7ec62805f45293cf877be5bc8124ae98a515c0aa42d6e053409653
1 parent 49d4c56 commit b3343d7

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

test/functional/p2p_unrequested_blocks.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -254,16 +254,11 @@ def run_test(self):
254254
test_node.send_message(msg_block(block_291))
255255

256256
# At this point we've sent an obviously-bogus block, wait for full processing
257-
# without assuming whether we will be disconnected or not
258-
try:
259-
# Only wait a short while so the test doesn't take forever if we do get
260-
# disconnected
261-
test_node.sync_with_ping(timeout=1)
262-
except AssertionError:
263-
test_node.wait_for_disconnect()
264-
265-
self.nodes[0].disconnect_p2ps()
266-
test_node = self.nodes[0].add_p2p_connection(P2PInterface())
257+
# and assume disconnection
258+
test_node.wait_for_disconnect()
259+
260+
self.nodes[0].disconnect_p2ps()
261+
test_node = self.nodes[0].add_p2p_connection(P2PInterface())
267262

268263
# We should have failed reorg and switched back to 290 (but have block 291)
269264
assert_equal(self.nodes[0].getblockcount(), 290)

0 commit comments

Comments
 (0)