From 26b7a04f6575f8e8f379ee8467df7894690eb6ca Mon Sep 17 00:00:00 2001 From: Odysseas Gabrielides Date: Wed, 21 Jun 2023 17:44:35 +0300 Subject: [PATCH] make version first field --- src/evo/simplifiedmns.h | 5 ++++- src/version.h | 5 ++++- test/functional/test_framework/messages.py | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/evo/simplifiedmns.h b/src/evo/simplifiedmns.h index dab50a2e9699..8becbee12137 100644 --- a/src/evo/simplifiedmns.h +++ b/src/evo/simplifiedmns.h @@ -139,8 +139,11 @@ class CSimplifiedMNListDiff SERIALIZE_METHODS(CSimplifiedMNListDiff, obj) { + if ((s.GetType() & SER_NETWORK) && s.GetVersion() >= MNLISTDIFF_VERSION_ORDER) { + READWRITE(obj.nVersion); + } READWRITE(obj.baseBlockHash, obj.blockHash, obj.cbTxMerkleTree, obj.cbTx); - if ((s.GetType() & SER_NETWORK) && s.GetVersion() >= BLS_SCHEME_PROTO_VERSION) { + if ((s.GetType() & SER_NETWORK) && s.GetVersion() >= BLS_SCHEME_PROTO_VERSION && s.GetVersion() < MNLISTDIFF_VERSION_ORDER) { READWRITE(obj.nVersion); } READWRITE(obj.deletedMNs, obj.mnList); diff --git a/src/version.h b/src/version.h index e1141c60e357..e543137892ad 100644 --- a/src/version.h +++ b/src/version.h @@ -11,7 +11,7 @@ */ -static const int PROTOCOL_VERSION = 70228; +static const int PROTOCOL_VERSION = 70229; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; @@ -52,6 +52,9 @@ static const int DMN_TYPE_PROTO_VERSION = 70227; //! Versioned Simplified Masternode List Entries were introduced in this version static const int SMNLE_VERSIONED_PROTO_VERSION = 70228; +//! Versioned Simplified Masternode List Entries were introduced in this version +static const int MNLISTDIFF_VERSION_ORDER = 70229; + // Make sure that none of the values above collide with `ADDRV2_FORMAT`. #endif // BITCOIN_VERSION_H diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py index 455e1b324597..ae0e7c3f725f 100755 --- a/test/functional/test_framework/messages.py +++ b/test/functional/test_framework/messages.py @@ -32,7 +32,7 @@ import dash_hash MIN_VERSION_SUPPORTED = 60001 -MY_VERSION = 70228 # SMNLE_VERSIONED_PROTO_VERSION +MY_VERSION = 70229 # MNLISTDIFF_VERSION_ORDER MY_SUBVERSION = b"/python-mininode-tester:0.0.3%s/" MY_RELAY = 1 # from version 70001 onwards, fRelay should be appended to version messages (BIP37) @@ -2038,13 +2038,13 @@ def __init__(self): self.newQuorums = [] def deserialize(self, f): + self.nVersion = struct.unpack("