File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ def test_getpeerinfo(self):
112112 no_version_peer_conntime = int (time .time ())
113113 self .nodes [0 ].setmocktime (no_version_peer_conntime )
114114 with self .nodes [0 ].assert_debug_log ([f"Added connection peer={ no_version_peer_id } " ]):
115- self .nodes [0 ].add_p2p_connection (P2PInterface (), send_version = False , wait_for_verack = False )
115+ no_version_peer = self .nodes [0 ].add_p2p_connection (P2PInterface (), send_version = False , wait_for_verack = False )
116116 self .nodes [0 ].setmocktime (0 )
117117 peer_info = self .nodes [0 ].getpeerinfo ()[no_version_peer_id ]
118118 peer_info .pop ("addr" )
@@ -153,7 +153,8 @@ def test_getpeerinfo(self):
153153 "version" : 0 ,
154154 },
155155 )
156- self .nodes [0 ].disconnect_p2ps ()
156+ no_version_peer .peer_disconnect ()
157+ self .wait_until (lambda : len (self .nodes [0 ].getpeerinfo ()) == 2 )
157158
158159 def test_getnettotals (self ):
159160 self .log .info ("Test getnettotals" )
Original file line number Diff line number Diff line change @@ -656,7 +656,8 @@ def num_test_p2p_connections(self):
656656 return len ([peer for peer in self .getpeerinfo () if peer ['subver' ] == P2P_SUBVERSION ])
657657
658658 def disconnect_p2ps (self ):
659- """Close all p2p connections to the node."""
659+ """Close all p2p connections to the node.
660+ Use only after each p2p has sent a version message to ensure the wait works."""
660661 for p in self .p2ps :
661662 p .peer_disconnect ()
662663 del self .p2ps [:]
You can’t perform that action at this time.
0 commit comments