Merge bitcoin/bitcoin#29511: test: Fix intermittent failure in rpc_net.py --v2transport

0487f91a20 test: Fix intermittent failure in rpc_net.py --v2transport (stratospher)

Pull request description:

  Fixes #29508.

  Make sure that v2 handshake is complete before comparing getpeerinfo outputs so that `transport_protocol_type` isn't stuck at 'detecting'.

  This is done by adding a wait_until statement till `transport_protocol_type = v2`  so that bitcoind waits until the v2 handshake is complete. (on the python side, this is ensured by default since `wait_for_handshake = True`  inside `add_p2p_connection()`)

ACKs for top commit:
  Sjors:
    ACK 0487f91a20
  mzumsande:
    Code Review ACK 0487f91a20
  achow101:
    ACK 0487f91a20
  vasild:
    ACK 0487f91a20

Tree-SHA512: 44dd646a61cd38da243f527df7321e22d1821c2b090be43673027746098caf450c6671708ed731ba257952df6b5886e64c9c2f9686a82f6ef0f25780b7a87d3d
This commit is contained in:
Ava Chow 2024-02-29 13:06:24 -05:00
commit 61aa981b8c
No known key found for this signature in database
GPG key ID: 17565732E08E5E41

View file

@ -113,6 +113,8 @@ class NetTest(BitcoinTestFramework):
self.nodes[0].setmocktime(no_version_peer_conntime)
with self.nodes[0].wait_for_new_peer():
no_version_peer = self.nodes[0].add_p2p_connection(P2PInterface(), send_version=False, wait_for_verack=False)
if self.options.v2transport:
self.wait_until(lambda: self.nodes[0].getpeerinfo()[no_version_peer_id]["transport_protocol_type"] == "v2")
self.nodes[0].setmocktime(0)
peer_info = self.nodes[0].getpeerinfo()[no_version_peer_id]
peer_info.pop("addr")