Merge bitcoin/bitcoin#32063: test: fix intermittent failure in p2p_orphan_handling.py

02942056fd test: fix intermittent failure in p2p_orphan_handling.py (Martin Zumsande)

Pull request description:

  If the mocktime is bumped before the node has successfully disconnected the peer, the requests for both parents could be spread over two GETDATAS: The first time `GetRequestsToSend` is invoked it would only request one tx from peer2, because the other one would only be available after peer1  was disconnected and its outstanding txrequest cleared.
  So two GETDATAs would be sent, which would make the test fail.

  Fixes #31700

ACKs for top commit:
  maflcko:
    lgtm ACK 02942056fd
  instagibbs:
    ACK 02942056fd

Tree-SHA512: 769200898345da197d86d673d9506f08f0a64b72a456e7e7c988ac37450d9c54ec65da1c8447c566c8578f7cfccdc5723ea680e636bfbe0b3d38265e5ef57774
This commit is contained in:
merge-script 2025-03-16 22:27:40 +08:00
commit 70a0ee89c6
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1

View file

@ -788,6 +788,7 @@ class OrphanHandlingTest(BitcoinTestFramework):
# Disconnect peer1. peer2 should become the new candidate for orphan resolution. # Disconnect peer1. peer2 should become the new candidate for orphan resolution.
peer1.peer_disconnect() peer1.peer_disconnect()
self.wait_until(lambda: node.num_test_p2p_connections() == 1)
node.bumpmocktime(TXREQUEST_TIME_SKIP) node.bumpmocktime(TXREQUEST_TIME_SKIP)
self.wait_until(lambda: len(node.getorphantxs(verbosity=2)[0]["from"]) == 1) self.wait_until(lambda: len(node.getorphantxs(verbosity=2)[0]["from"]) == 1)
# Both parents should be requested, now that they are both missing. # Both parents should be requested, now that they are both missing.