Skip to content

Commit 5574881

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#23354: Introduce new V4 format addrman
d891ae7 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 d891ae7 ajtowns: utACK d891ae7 vasild: ACK d891ae7 Tree-SHA512: de2153beb59152504ee0656dd0cc0b879b09136eb07e3ce0426d2fea778adfabacebbce5cf1a9a65dc99ad4e99cda42ab26743fe672fb82a9fbfec49c4cccb4d
2 parents 8bac3b1 + d891ae7 commit 5574881

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/addrman.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ void AddrManImpl::Serialize(Stream& s_) const
171171

172172
// Increment `lowest_compatible` iff a newly introduced format is incompatible with
173173
// the previous one.
174-
static constexpr uint8_t lowest_compatible = Format::V3_BIP155;
174+
static constexpr uint8_t lowest_compatible = Format::V4_MULTIPORT;
175175
s << static_cast<uint8_t>(INCOMPATIBILITY_BASE + lowest_compatible);
176176

177177
s << nKey;

src/addrman_impl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,15 @@ class AddrManImpl
157157
V1_DETERMINISTIC = 1, //!< for pre-asmap files
158158
V2_ASMAP = 2, //!< for files including asmap version
159159
V3_BIP155 = 3, //!< same as V2_ASMAP plus addresses are in BIP155 format
160+
V4_MULTIPORT = 4, //!< adds support for multiple ports per IP
160161
};
161162

162163
//! The maximum format this software knows it can unserialize. Also, we always serialize
163164
//! in this format.
164165
//! The format (first byte in the serialized stream) can be higher than this and
165166
//! still this software may be able to unserialize the file - if the second byte
166167
//! (see `lowest_compatible` in `Unserialize()`) is less or equal to this.
167-
static constexpr Format FILE_FORMAT = Format::V3_BIP155;
168+
static constexpr Format FILE_FORMAT = Format::V4_MULTIPORT;
168169

169170
//! The initial value of a field that is incremented every time an incompatible format
170171
//! change is made (such that old software versions would not be able to parse and

test/functional/feature_addrman.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
def serialize_addrman(
1919
*,
2020
format=1,
21-
lowest_compatible=3,
21+
lowest_compatible=4,
2222
net_magic="regtest",
2323
bucket_key=1,
2424
len_new=None,
@@ -75,7 +75,7 @@ def run_test(self):
7575
expected_msg=init_error(
7676
"Unsupported format of addrman database: 1. It is compatible with "
7777
"formats >=111, but the maximum supported by this version of "
78-
f"{self.config['environment']['PACKAGE_NAME']} is 3.: (.+)"
78+
f"{self.config['environment']['PACKAGE_NAME']} is 4.: (.+)"
7979
),
8080
match=ErrorMatch.FULL_REGEX,
8181
)

0 commit comments

Comments
 (0)