diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-07-13 10:31:38 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-07-13 10:32:19 +0200 |
commit | 631284f09a18a998a150e063fe8f29aa47e71e0b (patch) | |
tree | 06518a3394638788e0798641443b76fd6957f1cc /src | |
parent | 4db44acf2d5d3b40943c94b3960f42838255b7ad (diff) | |
parent | 7bb6f9bfdbd3b0b5594febc9a0ae2f84e6d7add1 (diff) |
Merge #19486: Remove unused constants `CADDR_TIME_VERSION` and `GETHEADERS_VERSION`
7bb6f9bfdbd3b0b5594febc9a0ae2f84e6d7add1 [protocol] Remove unused GETHEADERS_VERSION (John Newbery)
37a934e6b35bea2125732d2c074998d9fe70633e [protocol] Remove unused CADDR_TIME_VERSION (John Newbery)
Pull request description:
These constants are no longer required and can be removed.
Additional code comments are added to explain CAddress serialization.
ACKs for top commit:
MarcoFalke:
ACK 7bb6f9bfdbd3b0b5594febc9a0ae2f84e6d7add1 already an improvement, but maybe getting rid of INIT_PROTO_VERSION here would be an even stronger improvement (can be done later)
jonatack:
ACK 7bb6f9bfdbd3b0b5594febc9a0ae2f84e6d7add1
vasild:
ACK 7bb6f9bf
Tree-SHA512: 5382562c60fd677c86583754eca11aad3719064efe2e5ef4f307d693b583422ca8d385926c2582aaab899f502b151f2eb87a7ac23363b15f4fceaa06296f98e3
Diffstat (limited to 'src')
-rw-r--r-- | src/protocol.h | 8 | ||||
-rw-r--r-- | src/version.h | 9 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/protocol.h b/src/protocol.h index 985f44640b..9ab63a30fb 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -371,7 +371,13 @@ public: READWRITE(nVersion); } if ((s.GetType() & SER_DISK) || - (nVersion >= CADDR_TIME_VERSION && !(s.GetType() & SER_GETHASH))) { + (nVersion != INIT_PROTO_VERSION && !(s.GetType() & SER_GETHASH))) { + // The only time we serialize a CAddress object without nTime is in + // the initial VERSION messages which contain two CAddress records. + // At that point, the serialization version is INIT_PROTO_VERSION. + // After the version handshake, serialization version is >= + // MIN_PEER_PROTO_VERSION and all ADDR messages are serialized with + // nTime. READWRITE(obj.nTime); } READWRITE(Using<CustomUintFormatter<8>>(obj.nServices)); diff --git a/src/version.h b/src/version.h index d932b512d4..e5d1f5a7f9 100644 --- a/src/version.h +++ b/src/version.h @@ -14,15 +14,8 @@ static const int PROTOCOL_VERSION = 70015; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; -//! In this version, 'getheaders' was introduced. -static const int GETHEADERS_VERSION = 31800; - //! disconnect from peers older than this proto version -static const int MIN_PEER_PROTO_VERSION = GETHEADERS_VERSION; - -//! nTime field added to CAddress, starting with this version; -//! if possible, avoid requesting addresses nodes older than this -static const int CADDR_TIME_VERSION = 31402; +static const int MIN_PEER_PROTO_VERSION = 31800; //! BIP 0031, pong message, is enabled for all versions AFTER this one static const int BIP0031_VERSION = 60000; |