[test] Move MY_VERSION to p2p.py

The messages.py module should contain code and helpers for
[de]serializing p2p messages. Specific usage of those messages should
be in p2p.py. Therefore move MY_VERSION to p2p.py.

Also rename to P2P_VERSION to distinguish it from
other versioning used in Bitcoin/Bitcoin Core.

Also always set the nVersion field in CBlockLocator to 0 and ignore the
field in deserialized messages. The field is not currently used for
anything in Bitcoin Core.
This commit is contained in:
John Newbery
2020-11-28 11:41:25 +00:00
parent 652311165c
commit 7e158a6910
3 changed files with 14 additions and 8 deletions

View File

@ -80,6 +80,9 @@ logger = logging.getLogger("TestFramework.p2p")
# The minimum P2P version that this test framework supports
MIN_P2P_VERSION_SUPPORTED = 60001
# The P2P version that this test framework implements and sends in its `version` message
# Version 70016 supports wtxid relay
P2P_VERSION = 70016
MESSAGEMAP = {
b"addr": msg_addr,
@ -329,6 +332,7 @@ class P2PInterface(P2PConnection):
def peer_connect_send_version(self, services):
# Send a version msg
vt = msg_version()
vt.nVersion = P2P_VERSION
vt.nServices = services
vt.addrTo.ip = self.dstaddr
vt.addrTo.port = self.dstport