You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test: p2p: introduce helper for sending prepared VERSION message
This deduplicates code for sending out the VERSION message
(if available and not sent yet), currently used at three
different places:
1) in the `connection_made` asyncio callback
(for v1 connections that are not v2 reconnects)
2) at the end of `v2_handshake`, if the v2 handshake succeeded
3) in the `on_version` callback, if a reconnection with v1 happens
assertmessage.nVersion>=MIN_P2P_VERSION_SUPPORTED, "Version {} received. Test framework only supports versions greater than {}".format(message.nVersion, MIN_P2P_VERSION_SUPPORTED)
560
558
# reconnection using v1 P2P has happened since version message can be processed, previously unsent version message is sent using v1 P2P here
561
559
ifself.reconnect:
562
-
ifself.on_connection_send_msg:
563
-
self.send_message(self.on_connection_send_msg)
564
-
self.on_connection_send_msg=None
560
+
self.send_version()
565
561
self.reconnect=False
566
562
ifmessage.nVersion>=70016andself.wtxidrelay:
567
563
self.send_message(msg_wtxidrelay())
@@ -676,6 +672,11 @@ def test_function():
676
672
677
673
# Message sending helper functions
678
674
675
+
defsend_version(self):
676
+
ifself.on_connection_send_msg:
677
+
self.send_message(self.on_connection_send_msg)
678
+
self.on_connection_send_msg=None# Never used again
0 commit comments