@@ -634,7 +634,7 @@ def assert_start_raises_init_error(self, extra_args=None, expected_msg=None, mat
634634 assert_msg += "with expected error " + expected_msg
635635 self ._raise_assertion_error (assert_msg )
636636
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 ):
638638 """Add an inbound p2p connection to the node.
639639
640640 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):
645645 kwargs ['dstaddr' ] = '127.0.0.1'
646646
647647 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 )()
649649 self .p2ps .append (p2p_conn )
650650 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 )
651653 if wait_for_verack :
652654 # Wait for the node to send us the version and verack
653655 p2p_conn .wait_for_verack ()
0 commit comments