@@ -596,24 +596,24 @@ def connect_nodes(self, a, b):
596
596
self .wait_until (lambda : sum (peer ['bytesrecv_per_msg' ].pop ('verack' , 0 ) == 24 for peer in to_connection .getpeerinfo ()) == to_num_peers )
597
597
598
598
def disconnect_nodes (self , a , b ):
599
- def disconnect_nodes_helper (from_connection , node_num ):
600
- def get_peer_ids ():
599
+ def disconnect_nodes_helper (node_a , node_b ):
600
+ def get_peer_ids (from_connection , node_num ):
601
601
result = []
602
602
for peer in from_connection .getpeerinfo ():
603
603
if "testnode{}" .format (node_num ) in peer ['subver' ]:
604
604
result .append (peer ['id' ])
605
605
return result
606
606
607
- peer_ids = get_peer_ids ()
607
+ peer_ids = get_peer_ids (node_a , node_b . index )
608
608
if not peer_ids :
609
609
self .log .warning ("disconnect_nodes: {} and {} were not connected" .format (
610
- from_connection .index ,
611
- node_num ,
610
+ node_a .index ,
611
+ node_b . index ,
612
612
))
613
613
return
614
614
for peer_id in peer_ids :
615
615
try :
616
- from_connection .disconnectnode (nodeid = peer_id )
616
+ node_a .disconnectnode (nodeid = peer_id )
617
617
except JSONRPCException as e :
618
618
# If this node is disconnected between calculating the peer id
619
619
# and issuing the disconnect, don't worry about it.
@@ -622,9 +622,10 @@ def get_peer_ids():
622
622
raise
623
623
624
624
# wait to disconnect
625
- self .wait_until (lambda : not get_peer_ids (), timeout = 5 )
625
+ self .wait_until (lambda : not get_peer_ids (node_a , node_b .index ), timeout = 5 )
626
+ self .wait_until (lambda : not get_peer_ids (node_b , node_a .index ), timeout = 5 )
626
627
627
- disconnect_nodes_helper (self .nodes [a ], b )
628
+ disconnect_nodes_helper (self .nodes [a ], self . nodes [ b ] )
628
629
629
630
def split_network (self ):
630
631
"""
0 commit comments