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):
112
112
no_version_peer_conntime = int (time .time ())
113
113
self .nodes [0 ].setmocktime (no_version_peer_conntime )
114
114
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 )
116
116
self .nodes [0 ].setmocktime (0 )
117
117
peer_info = self .nodes [0 ].getpeerinfo ()[no_version_peer_id ]
118
118
peer_info .pop ("addr" )
@@ -153,7 +153,8 @@ def test_getpeerinfo(self):
153
153
"version" : 0 ,
154
154
},
155
155
)
156
- self .nodes [0 ].disconnect_p2ps ()
156
+ no_version_peer .peer_disconnect ()
157
+ self .wait_until (lambda : len (self .nodes [0 ].getpeerinfo ()) == 2 )
157
158
158
159
def test_getnettotals (self ):
159
160
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):
656
656
return len ([peer for peer in self .getpeerinfo () if peer ['subver' ] == P2P_SUBVERSION ])
657
657
658
658
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."""
660
661
for p in self .p2ps :
661
662
p .peer_disconnect ()
662
663
del self .p2ps [:]
You can’t perform that action at this time.
0 commit comments