aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-10-29 13:12:47 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-10-29 13:13:03 +0200
commit5574881ce329f91cc5bbc2b9585860a45fde7c3c (patch)
tree8f2b22a9dd20dcbbf21c5c006b10d2d66f174e75
parent8bac3b1096410960c19957b16c544058726b51cc (diff)
parentd891ae768185b464cae476c16c74c365372d4a3c (diff)
downloadbitcoin-5574881ce329f91cc5bbc2b9585860a45fde7c3c.tar.xz
Merge bitcoin/bitcoin#23354: Introduce new V4 format addrman
d891ae768185b464cae476c16c74c365372d4a3c Introduce new V4 format addrman (Pieter Wuille) Pull request description: #23306 effectively changed the on-disk format in an incompatible way: old deserializers cannot deal with multiple entries for the same IP. Introduce a `V4_MULTIPORT` format, and increment the compatibility base, so that old versions correctly recognize it as an incompatible future version, rather than corruption. ACKs for top commit: naumenkogs: ACK d891ae768185b464cae476c16c74c365372d4a3c ajtowns: utACK d891ae768185b464cae476c16c74c365372d4a3c vasild: ACK d891ae768185b464cae476c16c74c365372d4a3c Tree-SHA512: de2153beb59152504ee0656dd0cc0b879b09136eb07e3ce0426d2fea778adfabacebbce5cf1a9a65dc99ad4e99cda42ab26743fe672fb82a9fbfec49c4cccb4d
-rw-r--r--src/addrman.cpp2
-rw-r--r--src/addrman_impl.h3
-rwxr-xr-xtest/functional/feature_addrman.py4
3 files changed, 5 insertions, 4 deletions
diff --git a/src/addrman.cpp b/src/addrman.cpp
index 86f56052c1..b579995a2c 100644
--- a/src/addrman.cpp
+++ b/src/addrman.cpp
@@ -171,7 +171,7 @@ void AddrManImpl::Serialize(Stream& s_) const
// Increment `lowest_compatible` iff a newly introduced format is incompatible with
// the previous one.
- static constexpr uint8_t lowest_compatible = Format::V3_BIP155;
+ static constexpr uint8_t lowest_compatible = Format::V4_MULTIPORT;
s << static_cast<uint8_t>(INCOMPATIBILITY_BASE + lowest_compatible);
s << nKey;
diff --git a/src/addrman_impl.h b/src/addrman_impl.h
index f8191d6b85..e8e7c15a19 100644
--- a/src/addrman_impl.h
+++ b/src/addrman_impl.h
@@ -157,6 +157,7 @@ private:
V1_DETERMINISTIC = 1, //!< for pre-asmap files
V2_ASMAP = 2, //!< for files including asmap version
V3_BIP155 = 3, //!< same as V2_ASMAP plus addresses are in BIP155 format
+ V4_MULTIPORT = 4, //!< adds support for multiple ports per IP
};
//! The maximum format this software knows it can unserialize. Also, we always serialize
@@ -164,7 +165,7 @@ private:
//! The format (first byte in the serialized stream) can be higher than this and
//! still this software may be able to unserialize the file - if the second byte
//! (see `lowest_compatible` in `Unserialize()`) is less or equal to this.
- static constexpr Format FILE_FORMAT = Format::V3_BIP155;
+ static constexpr Format FILE_FORMAT = Format::V4_MULTIPORT;
//! The initial value of a field that is incremented every time an incompatible format
//! change is made (such that old software versions would not be able to parse and
diff --git a/test/functional/feature_addrman.py b/test/functional/feature_addrman.py
index 93d50c1369..14a4f8abb7 100755
--- a/test/functional/feature_addrman.py
+++ b/test/functional/feature_addrman.py
@@ -18,7 +18,7 @@ from test_framework.util import assert_equal
def serialize_addrman(
*,
format=1,
- lowest_compatible=3,
+ lowest_compatible=4,
net_magic="regtest",
bucket_key=1,
len_new=None,
@@ -75,7 +75,7 @@ class AddrmanTest(BitcoinTestFramework):
expected_msg=init_error(
"Unsupported format of addrman database: 1. It is compatible with "
"formats >=111, but the maximum supported by this version of "
- f"{self.config['environment']['PACKAGE_NAME']} is 3.: (.+)"
+ f"{self.config['environment']['PACKAGE_NAME']} is 4.: (.+)"
),
match=ErrorMatch.FULL_REGEX,
)