Skip to content

Commit 85feb09

Browse files
committed
Merge bitcoin/bitcoin#32092: test: Fix intermittent issue in p2p_orphan_handling.py
fa310cc test: Fix intermittent issue in p2p_orphan_handling.py (MarcoFalke) Pull request description: The test may fail intermittently when the `net` thread is lagging while calling `DeleteNode`. This may result in a split `getdata`, meaning that `peer2.wait_for_parent_requests([int(parent_peekaboo_AB["txid"], 16), int(parent_missing["txid"], 16)])` fails. Fix it by adding a sync on the `net` thread. Fixes #31700 ACKs for top commit: mzumsande: Code Review ACK fa310cc Tree-SHA512: e4a58093ab5b9e280c479b845fecb5d228e65519ea3dc2111b393202225fd0feded423e8812452454b6b9348cb37a9c1b01b9d1b1802e9f4aa76b9e56b4b54ef
2 parents b858b72 + fa310cc commit 85feb09

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

test/functional/p2p_orphan_handling.py

+1
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,7 @@ def test_parents_change(self):
789789
# Disconnect peer1. peer2 should become the new candidate for orphan resolution.
790790
peer1.peer_disconnect()
791791
self.wait_until(lambda: node.num_test_p2p_connections() == 1)
792+
peer2.sync_with_ping() # Sync with the 'net' thread which completes the disconnection fully
792793
node.bumpmocktime(TXREQUEST_TIME_SKIP)
793794
self.wait_until(lambda: len(node.getorphantxs(verbosity=2)[0]["from"]) == 1)
794795
# Both parents should be requested, now that they are both missing.

test/functional/test_framework/test_node.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,8 @@ def num_test_p2p_connections(self):
826826

827827
def disconnect_p2ps(self):
828828
"""Close all p2p connections to the node.
829-
Use only after each p2p has sent a version message to ensure the wait works."""
829+
The state of the peers (such as txrequests) may not be fully cleared
830+
yet, even after this method returns."""
830831
for p in self.p2ps:
831832
p.peer_disconnect()
832833
del self.p2ps[:]

0 commit comments

Comments
 (0)