Skip to content

Commit

Permalink
test: Fix intermittent issue in p2p_handshake.py
Browse files Browse the repository at this point in the history
If we reuse the same port when disconnecting and establishing connections
again, we might hit this scenario:
- disconnection is done on python side for P2PConnection
- disconnection is not complete on c++ side for TestNode
- we're trying to establish a new connection on same port again

Prevent this scenario from happening by ensuring disconnection on c++
side for TestNode as well.
  • Loading branch information
stratospher committed Apr 18, 2024
1 parent c8e3978 commit 6b02c11
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions test/functional/p2p_handshake.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def add_outbound_connection(self, node, connection_type, services, wait_for_disc
peer.sync_with_ping()
peer.peer_disconnect()
peer.wait_for_disconnect()
self.wait_until(lambda: len(node.getpeerinfo()) == 0)

def test_desirable_service_flags(self, node, service_flag_tests, desirable_service_flags, expect_disconnect):
"""Check that connecting to a peer either fails or succeeds depending on its offered
Expand Down

0 comments on commit 6b02c11

Please sign in to comment.