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: adhere to typical VERSION message protocol flow
The test framework's p2p implementation currently sends out it's VERSION
message immediately after an inbound connection (i.e. TestNode outbound
connection) is made. This doesn't follow the usual protocol flow where
the initiator sends a version first, and the responders processes that
and only then responds with its own version message. Change that
accordingly by only sending immediate VERSION message for outbound
connections (or after v2 handshake for v2 connections, respectively),
and sending out VERSION messages as response for incoming VERSION
messages (i.e. in the function `on_version`) for inbound connections.
Note that some of the overruled `on_version` methods in functional tests
needed to be changed to send the version explicitly.
raiseValueError("invalid v2 mac tag in handshake authentication")
285
285
self.recvbuf=self.recvbuf[length:]
286
286
ifself.v2_state.tried_v2_handshake:
287
-
self.send_version()
287
+
# for v2 outbound connections, send version message immediately after v2 handshake
288
+
ifself.p2p_connected_to_node:
289
+
self.send_version()
288
290
# process post-v2-handshake data immediately, if available
289
291
iflen(self.recvbuf) >0:
290
292
self._on_data()
@@ -558,8 +560,9 @@ def on_verack(self, message):
558
560
559
561
defon_version(self, message):
560
562
assertmessage.nVersion>=MIN_P2P_VERSION_SUPPORTED, "Version {} received. Test framework only supports versions greater than {}".format(message.nVersion, MIN_P2P_VERSION_SUPPORTED)
561
-
# reconnection using v1 P2P has happened since version message can be processed, previously unsent version message is sent using v1 P2P here
562
-
ifself.reconnect:
563
+
# for inbound connections, reply to version with own version message
564
+
# (could be due to v1 reconnect after a failed v2 handshake)
0 commit comments