@@ -634,7 +634,7 @@ def assert_start_raises_init_error(self, extra_args=None, expected_msg=None, mat
634
634
assert_msg += "with expected error " + expected_msg
635
635
self ._raise_assertion_error (assert_msg )
636
636
637
- def add_p2p_connection (self , p2p_conn , * , wait_for_verack = True , ** kwargs ):
637
+ def add_p2p_connection (self , p2p_conn , * , wait_for_verack = True , send_version = True , ** kwargs ):
638
638
"""Add an inbound p2p connection to the node.
639
639
640
640
This method adds the p2p connection to the self.p2ps list and also
@@ -645,9 +645,11 @@ def add_p2p_connection(self, p2p_conn, *, wait_for_verack=True, **kwargs):
645
645
kwargs ['dstaddr' ] = '127.0.0.1'
646
646
647
647
p2p_conn .p2p_connected_to_node = True
648
- p2p_conn .peer_connect (** kwargs , net = self .chain , timeout_factor = self .timeout_factor )()
648
+ p2p_conn .peer_connect (** kwargs , send_version = send_version , net = self .chain , timeout_factor = self .timeout_factor )()
649
649
self .p2ps .append (p2p_conn )
650
650
p2p_conn .wait_until (lambda : p2p_conn .is_connected , check_connected = False )
651
+ if send_version :
652
+ p2p_conn .wait_until (lambda : not p2p_conn .on_connection_send_msg )
651
653
if wait_for_verack :
652
654
# Wait for the node to send us the version and verack
653
655
p2p_conn .wait_for_verack ()
0 commit comments