mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
merge bitcoin#26553: Fix intermittent failure in rpc_net.py
This commit is contained in:
parent
5bf245b4a0
commit
1bf135bbc9
@ -114,7 +114,7 @@ class NetTest(DashTestFramework):
|
|||||||
no_version_peer_id = 3
|
no_version_peer_id = 3
|
||||||
no_version_peer_conntime = self.mocktime
|
no_version_peer_conntime = self.mocktime
|
||||||
with self.nodes[0].assert_debug_log([f"Added connection peer={no_version_peer_id}"]):
|
with self.nodes[0].assert_debug_log([f"Added connection peer={no_version_peer_id}"]):
|
||||||
self.nodes[0].add_p2p_connection(P2PInterface(), send_version=False, wait_for_verack=False)
|
no_version_peer = self.nodes[0].add_p2p_connection(P2PInterface(), send_version=False, wait_for_verack=False)
|
||||||
peer_info = self.nodes[0].getpeerinfo()[no_version_peer_id]
|
peer_info = self.nodes[0].getpeerinfo()[no_version_peer_id]
|
||||||
peer_info.pop("addr")
|
peer_info.pop("addr")
|
||||||
peer_info.pop("addrbind")
|
peer_info.pop("addrbind")
|
||||||
@ -155,7 +155,8 @@ class NetTest(DashTestFramework):
|
|||||||
"version": 0,
|
"version": 0,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
self.nodes[0].disconnect_p2ps()
|
no_version_peer.peer_disconnect()
|
||||||
|
self.wait_until(lambda: len(self.nodes[0].getpeerinfo()) == 3)
|
||||||
|
|
||||||
def test_getnettotals(self):
|
def test_getnettotals(self):
|
||||||
self.log.info("Test getnettotals")
|
self.log.info("Test getnettotals")
|
||||||
|
@ -682,7 +682,8 @@ class TestNode():
|
|||||||
return len([peer for peer in self.getpeerinfo() if P2P_SUBVERSION % "" in peer['subver']])
|
return len([peer for peer in self.getpeerinfo() if P2P_SUBVERSION % "" in peer['subver']])
|
||||||
|
|
||||||
def disconnect_p2ps(self):
|
def disconnect_p2ps(self):
|
||||||
"""Close all p2p connections to the node."""
|
"""Close all p2p connections to the node.
|
||||||
|
Use only after each p2p has sent a version message to ensure the wait works."""
|
||||||
for p in self.p2ps:
|
for p in self.p2ps:
|
||||||
p.peer_disconnect()
|
p.peer_disconnect()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user