@@ -31,9 +31,9 @@ class P2PHandshakeTest(BitcoinTestFramework):
31
31
def set_test_params (self ):
32
32
self .num_nodes = 1
33
33
34
- def add_outbound_connection (self , node , connection_type , services , wait_for_disconnect ):
34
+ def add_outbound_connection (self , node , peer_id , connection_type , services , wait_for_disconnect ):
35
35
peer = node .add_outbound_p2p_connection (
36
- P2PInterface (), p2p_idx = 0 , wait_for_disconnect = wait_for_disconnect ,
36
+ P2PInterface (), p2p_idx = peer_id , wait_for_disconnect = wait_for_disconnect ,
37
37
connection_type = connection_type , services = services ,
38
38
supports_v2_p2p = self .options .v2transport , advertise_v2_p2p = self .options .v2transport )
39
39
if not wait_for_disconnect :
@@ -47,6 +47,7 @@ def test_desirable_service_flags(self, node, service_flag_tests, desirable_servi
47
47
service flags in the VERSION message. The test is exercised for all relevant
48
48
outbound connection types where the desirable service flags check is done."""
49
49
CONNECTION_TYPES = ["outbound-full-relay" , "block-relay-only" , "addr-fetch" ]
50
+ peer_id = 0
50
51
for conn_type , services in itertools .product (CONNECTION_TYPES , service_flag_tests ):
51
52
if self .options .v2transport :
52
53
services |= NODE_P2P_V2
@@ -57,10 +58,11 @@ def test_desirable_service_flags(self, node, service_flag_tests, desirable_servi
57
58
expected_debug_log = f'does not offer the expected services ' \
58
59
f'({ services :08x} offered, { desirable_service_flags :08x} expected)'
59
60
with node .assert_debug_log ([expected_debug_log ]):
60
- self .add_outbound_connection (node , conn_type , services , wait_for_disconnect = True )
61
+ self .add_outbound_connection (node , peer_id , conn_type , services , wait_for_disconnect = True )
61
62
else :
62
63
assert (services & desirable_service_flags ) == desirable_service_flags
63
- self .add_outbound_connection (node , conn_type , services , wait_for_disconnect = False )
64
+ self .add_outbound_connection (node , peer_id , conn_type , services , wait_for_disconnect = False )
65
+ peer_id += 1
64
66
65
67
def generate_at_mocktime (self , time ):
66
68
self .nodes [0 ].setmocktime (time )
@@ -85,7 +87,7 @@ def run_test(self):
85
87
86
88
self .log .info ("Check that feeler connections get disconnected immediately" )
87
89
with node .assert_debug_log ([f"feeler connection completed" ]):
88
- self .add_outbound_connection (node , "feeler" , NODE_NONE , wait_for_disconnect = True )
90
+ self .add_outbound_connection (node , 0 , "feeler" , NODE_NONE , wait_for_disconnect = True )
89
91
90
92
91
93
if __name__ == '__main__' :
0 commit comments