Skip to content

Commit a8fdfea

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#22791: init: Fix asmap/addrman initialization order bug
724c497 [fuzz] Add ConsumeAsmap() function (John Newbery) 5840476 [addrman] Make m_asmap private (John Newbery) f9002cb [net] Rename the copyStats arg from m_asmap to asmap (John Newbery) f572f2b [addrman] Set m_asmap in CAddrMan initializer list (John Newbery) 5932478 [net] Remove CConnMan::SetAsmap() (John Newbery) 50fd770 [init] Read/decode asmap before constructing addrman (John Newbery) Pull request description: Commit 181a120 introduced an initialization order bug: CAddrMan's m_asmap must be set before deserializing peers.dat. The first commit restores the correct initialization order. The remaining commits make `CAddrMan::m_asmap` usage safer: - don't reach into `CAddrMan`'s internal data from `CConnMan` - set `m_asmap` in the initializer list and make it const - make `m_asmap` private, and access it (as a reference to const) from a getter. This ensures that peers.dat deserialization must happen after setting m_asmap, since m_asmap is set during CAddrMan construction. ACKs for top commit: mzumsande: Tested ACK 724c497 amitiuttarwar: code review but utACK 724c497 naumenkogs: utACK 724c497 vasild: ACK 724c497 MarcoFalke: review ACK 724c497 👫 Tree-SHA512: 684a4cf9e3d4496c9997fb2bc4ec874809987055c157ec3fad1d2143b8223df52b5a0af787d028930b27388c8efeba0aeb2446cb35c337a5552ae76112ade726
2 parents 2c6707b + 724c497 commit a8fdfea

File tree

13 files changed

+92
-92
lines changed

13 files changed

+92
-92
lines changed

src/addrman.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,11 @@ double CAddrInfo::GetChance(int64_t nNow) const
9898
return fChance;
9999
}
100100

101-
CAddrMan::CAddrMan(bool deterministic, int32_t consistency_check_ratio)
101+
CAddrMan::CAddrMan(std::vector<bool> asmap, bool deterministic, int32_t consistency_check_ratio)
102102
: insecure_rand{deterministic}
103103
, nKey{deterministic ? uint256{1} : insecure_rand.rand256()}
104104
, m_consistency_check_ratio{consistency_check_ratio}
105+
, m_asmap{std::move(asmap)}
105106
{
106107
for (auto& bucket : vvNew) {
107108
for (auto& entry : bucket) {

src/addrman.h

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -149,22 +149,6 @@ static constexpr int ADDRMAN_BUCKET_SIZE{1 << ADDRMAN_BUCKET_SIZE_LOG2};
149149
class CAddrMan
150150
{
151151
public:
152-
// Compressed IP->ASN mapping, loaded from a file when a node starts.
153-
// Should be always empty if no file was provided.
154-
// This mapping is then used for bucketing nodes in Addrman.
155-
//
156-
// If asmap is provided, nodes will be bucketed by
157-
// AS they belong to, in order to make impossible for a node
158-
// to connect to several nodes hosted in a single AS.
159-
// This is done in response to Erebus attack, but also to generally
160-
// diversify the connections every node creates,
161-
// especially useful when a large fraction of nodes
162-
// operate under a couple of cloud providers.
163-
//
164-
// If a new asmap was provided, the existing records
165-
// would be re-bucketed accordingly.
166-
std::vector<bool> m_asmap;
167-
168152
// Read asmap from provided binary file
169153
static std::vector<bool> DecodeAsmap(fs::path path);
170154

@@ -174,7 +158,7 @@ class CAddrMan
174158
template <typename Stream>
175159
void Unserialize(Stream& s_) EXCLUSIVE_LOCKS_REQUIRED(!cs);
176160

177-
explicit CAddrMan(bool deterministic, int32_t consistency_check_ratio);
161+
explicit CAddrMan(std::vector<bool> asmap, bool deterministic, int32_t consistency_check_ratio);
178162

179163
~CAddrMan()
180164
{
@@ -296,6 +280,8 @@ class CAddrMan
296280
Check();
297281
}
298282

283+
const std::vector<bool>& GetAsmap() const { return m_asmap; }
284+
299285
private:
300286
//! A mutex to protect the inner data structures.
301287
mutable Mutex cs;
@@ -363,6 +349,22 @@ class CAddrMan
363349
/** Perform consistency checks every m_consistency_check_ratio operations (if non-zero). */
364350
const int32_t m_consistency_check_ratio;
365351

352+
// Compressed IP->ASN mapping, loaded from a file when a node starts.
353+
// Should be always empty if no file was provided.
354+
// This mapping is then used for bucketing nodes in Addrman.
355+
//
356+
// If asmap is provided, nodes will be bucketed by
357+
// AS they belong to, in order to make impossible for a node
358+
// to connect to several nodes hosted in a single AS.
359+
// This is done in response to Erebus attack, but also to generally
360+
// diversify the connections every node creates,
361+
// especially useful when a large fraction of nodes
362+
// operate under a couple of cloud providers.
363+
//
364+
// If a new asmap was provided, the existing records
365+
// would be re-bucketed accordingly.
366+
const std::vector<bool> m_asmap;
367+
366368
//! Find an entry.
367369
CAddrInfo* Find(const CNetAddr& addr, int *pnId = nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs);
368370

src/bench/addrman.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ static void AddrManAdd(benchmark::Bench& bench)
7373
CreateAddresses();
7474

7575
bench.run([&] {
76-
CAddrMan addrman{/* deterministic */ false, /* consistency_check_ratio */ 0};
76+
CAddrMan addrman{/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 0};
7777
AddAddressesToAddrMan(addrman);
7878
});
7979
}
8080

8181
static void AddrManSelect(benchmark::Bench& bench)
8282
{
83-
CAddrMan addrman(/* deterministic */ false, /* consistency_check_ratio */ 0);
83+
CAddrMan addrman(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 0);
8484

8585
FillAddrMan(addrman);
8686

@@ -92,7 +92,7 @@ static void AddrManSelect(benchmark::Bench& bench)
9292

9393
static void AddrManGetAddr(benchmark::Bench& bench)
9494
{
95-
CAddrMan addrman(/* deterministic */ false, /* consistency_check_ratio */ 0);
95+
CAddrMan addrman(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 0);
9696

9797
FillAddrMan(addrman);
9898

@@ -114,7 +114,7 @@ static void AddrManGood(benchmark::Bench& bench)
114114

115115
std::vector<std::unique_ptr<CAddrMan>> addrmans(addrman_count);
116116
for (size_t i{0}; i < addrman_count; ++i) {
117-
addrmans[i] = std::make_unique<CAddrMan>(/* deterministic */ false, /* consistency_check_ratio */ 0);
117+
addrmans[i] = std::make_unique<CAddrMan>(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 0);
118118
FillAddrMan(*addrmans[i]);
119119
}
120120

src/init.cpp

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,10 +1171,38 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
11711171
fDiscover = args.GetBoolArg("-discover", true);
11721172
const bool ignores_incoming_txs{args.GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY)};
11731173

1174-
assert(!node.addrman);
1175-
auto check_addrman = std::clamp<int32_t>(args.GetArg("-checkaddrman", DEFAULT_ADDRMAN_CONSISTENCY_CHECKS), 0, 1000000);
1176-
node.addrman = std::make_unique<CAddrMan>(/* deterministic */ false, /* consistency_check_ratio */ check_addrman);
11771174
{
1175+
// Initialize addrman
1176+
assert(!node.addrman);
1177+
1178+
// Read asmap file if configured
1179+
std::vector<bool> asmap;
1180+
if (args.IsArgSet("-asmap")) {
1181+
fs::path asmap_path = fs::path(args.GetArg("-asmap", ""));
1182+
if (asmap_path.empty()) {
1183+
asmap_path = DEFAULT_ASMAP_FILENAME;
1184+
}
1185+
if (!asmap_path.is_absolute()) {
1186+
asmap_path = gArgs.GetDataDirNet() / asmap_path;
1187+
}
1188+
if (!fs::exists(asmap_path)) {
1189+
InitError(strprintf(_("Could not find asmap file %s"), asmap_path));
1190+
return false;
1191+
}
1192+
asmap = CAddrMan::DecodeAsmap(asmap_path);
1193+
if (asmap.size() == 0) {
1194+
InitError(strprintf(_("Could not parse asmap file %s"), asmap_path));
1195+
return false;
1196+
}
1197+
const uint256 asmap_version = SerializeHash(asmap);
1198+
LogPrintf("Using asmap version %s for IP bucketing\n", asmap_version.ToString());
1199+
} else {
1200+
LogPrintf("Using /16 prefix for IP bucketing\n");
1201+
}
1202+
1203+
auto check_addrman = std::clamp<int32_t>(args.GetArg("-checkaddrman", DEFAULT_ADDRMAN_CONSISTENCY_CHECKS), 0, 1000000);
1204+
node.addrman = std::make_unique<CAddrMan>(asmap, /* deterministic */ false, /* consistency_check_ratio */ check_addrman);
1205+
11781206
// Load addresses from peers.dat
11791207
uiInterface.InitMessage(_("Loading P2P addresses…").translated);
11801208
int64_t nStart = GetTimeMillis();
@@ -1183,11 +1211,12 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
11831211
LogPrintf("Loaded %i addresses from peers.dat %dms\n", node.addrman->size(), GetTimeMillis() - nStart);
11841212
} else {
11851213
// Addrman can be in an inconsistent state after failure, reset it
1186-
node.addrman = std::make_unique<CAddrMan>(/* deterministic */ false, /* consistency_check_ratio */ check_addrman);
1214+
node.addrman = std::make_unique<CAddrMan>(asmap, /* deterministic */ false, /* consistency_check_ratio */ check_addrman);
11871215
LogPrintf("Recreating peers.dat\n");
11881216
adb.Write(*node.addrman);
11891217
}
11901218
}
1219+
11911220
assert(!node.banman);
11921221
node.banman = std::make_unique<BanMan>(gArgs.GetDataDirNet() / "banlist", &uiInterface, args.GetArg("-bantime", DEFAULT_MISBEHAVING_BANTIME));
11931222
assert(!node.connman);
@@ -1292,31 +1321,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
12921321
return InitError(ResolveErrMsg("externalip", strAddr));
12931322
}
12941323

1295-
// Read asmap file if configured
1296-
if (args.IsArgSet("-asmap")) {
1297-
fs::path asmap_path = fs::path(args.GetArg("-asmap", ""));
1298-
if (asmap_path.empty()) {
1299-
asmap_path = DEFAULT_ASMAP_FILENAME;
1300-
}
1301-
if (!asmap_path.is_absolute()) {
1302-
asmap_path = gArgs.GetDataDirNet() / asmap_path;
1303-
}
1304-
if (!fs::exists(asmap_path)) {
1305-
InitError(strprintf(_("Could not find asmap file %s"), asmap_path));
1306-
return false;
1307-
}
1308-
std::vector<bool> asmap = CAddrMan::DecodeAsmap(asmap_path);
1309-
if (asmap.size() == 0) {
1310-
InitError(strprintf(_("Could not parse asmap file %s"), asmap_path));
1311-
return false;
1312-
}
1313-
const uint256 asmap_version = SerializeHash(asmap);
1314-
node.connman->SetAsmap(std::move(asmap));
1315-
LogPrintf("Using asmap version %s for IP bucketing\n", asmap_version.ToString());
1316-
} else {
1317-
LogPrintf("Using /16 prefix for IP bucketing\n");
1318-
}
1319-
13201324
#if ENABLE_ZMQ
13211325
g_zmq_notification_interface = CZMQNotificationInterface::Create();
13221326

src/net.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -552,14 +552,14 @@ Network CNode::ConnectedThroughNetwork() const
552552

553553
#undef X
554554
#define X(name) stats.name = name
555-
void CNode::copyStats(CNodeStats &stats, const std::vector<bool> &m_asmap)
555+
void CNode::CopyStats(CNodeStats& stats, const std::vector<bool>& asmap)
556556
{
557557
stats.nodeid = this->GetId();
558558
X(nServices);
559559
X(addr);
560560
X(addrBind);
561561
stats.m_network = ConnectedThroughNetwork();
562-
stats.m_mapped_as = addr.GetMappedAS(m_asmap);
562+
stats.m_mapped_as = addr.GetMappedAS(asmap);
563563
if (m_tx_relay != nullptr) {
564564
LOCK(m_tx_relay->cs_filter);
565565
stats.fRelayTxes = m_tx_relay->fRelayTxes;
@@ -1921,7 +1921,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect)
19211921
case ConnectionType::BLOCK_RELAY:
19221922
case ConnectionType::ADDR_FETCH:
19231923
case ConnectionType::FEELER:
1924-
setConnected.insert(pnode->addr.GetGroup(addrman.m_asmap));
1924+
setConnected.insert(pnode->addr.GetGroup(addrman.GetAsmap()));
19251925
} // no default case, so the compiler can warn about missing cases
19261926
}
19271927
}
@@ -1995,7 +1995,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect)
19951995
m_anchors.pop_back();
19961996
if (!addr.IsValid() || IsLocal(addr) || !IsReachable(addr) ||
19971997
!HasAllDesirableServiceFlags(addr.nServices) ||
1998-
setConnected.count(addr.GetGroup(addrman.m_asmap))) continue;
1998+
setConnected.count(addr.GetGroup(addrman.GetAsmap()))) continue;
19991999
addrConnect = addr;
20002000
LogPrint(BCLog::NET, "Trying to make an anchor connection to %s\n", addrConnect.ToString());
20012001
break;
@@ -2035,7 +2035,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect)
20352035
}
20362036

20372037
// Require outbound connections, other than feelers, to be to distinct network groups
2038-
if (!fFeeler && setConnected.count(addr.GetGroup(addrman.m_asmap))) {
2038+
if (!fFeeler && setConnected.count(addr.GetGroup(addrman.GetAsmap()))) {
20392039
break;
20402040
}
20412041

@@ -2804,7 +2804,7 @@ void CConnman::GetNodeStats(std::vector<CNodeStats>& vstats) const
28042804
vstats.reserve(vNodes.size());
28052805
for (CNode* pnode : vNodes) {
28062806
vstats.emplace_back();
2807-
pnode->copyStats(vstats.back(), addrman.m_asmap);
2807+
pnode->CopyStats(vstats.back(), addrman.GetAsmap());
28082808
}
28092809
}
28102810

@@ -3067,7 +3067,7 @@ CSipHasher CConnman::GetDeterministicRandomizer(uint64_t id) const
30673067

30683068
uint64_t CConnman::CalculateKeyedNetGroup(const CAddress& ad) const
30693069
{
3070-
std::vector<unsigned char> vchNetGroup(ad.GetGroup(addrman.m_asmap));
3070+
std::vector<unsigned char> vchNetGroup(ad.GetGroup(addrman.GetAsmap()));
30713071

30723072
return GetDeterministicRandomizer(RANDOMIZER_ID_NETGROUP).Write(vchNetGroup.data(), vchNetGroup.size()).Finalize();
30733073
}

src/net.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ class CNode
652652

653653
void CloseSocketDisconnect();
654654

655-
void copyStats(CNodeStats &stats, const std::vector<bool> &m_asmap);
655+
void CopyStats(CNodeStats& stats, const std::vector<bool>& asmap);
656656

657657
ServiceFlags GetLocalServices() const
658658
{
@@ -943,8 +943,6 @@ class CConnman
943943
*/
944944
std::chrono::microseconds PoissonNextSendInbound(std::chrono::microseconds now, std::chrono::seconds average_interval);
945945

946-
void SetAsmap(std::vector<bool> asmap) { addrman.m_asmap = std::move(asmap); }
947-
948946
/** Return true if we should disconnect the peer for failing an inactivity check. */
949947
bool ShouldRunInactivityChecks(const CNode& node, std::optional<int64_t> now=std::nullopt) const;
950948

src/test/addrman_tests.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class CAddrManSerializationMock : public CAddrMan
2626
virtual void Serialize(CDataStream& s) const = 0;
2727

2828
CAddrManSerializationMock()
29-
: CAddrMan(/* deterministic */ true, /* consistency_check_ratio */ 100)
29+
: CAddrMan(/* asmap */ std::vector<bool>(), /* deterministic */ true, /* consistency_check_ratio */ 100)
3030
{}
3131
};
3232

@@ -82,10 +82,9 @@ class CAddrManTest : public CAddrMan
8282
public:
8383
explicit CAddrManTest(bool makeDeterministic = true,
8484
std::vector<bool> asmap = std::vector<bool>())
85-
: CAddrMan(makeDeterministic, /* consistency_check_ratio */ 100)
85+
: CAddrMan(asmap, makeDeterministic, /* consistency_check_ratio */ 100)
8686
{
8787
deterministic = makeDeterministic;
88-
m_asmap = asmap;
8988
}
9089

9190
CAddrInfo* Find(const CNetAddr& addr, int* pnId = nullptr)
@@ -1024,7 +1023,7 @@ BOOST_AUTO_TEST_CASE(caddrdb_read)
10241023
// Test that the de-serialization does not throw an exception.
10251024
CDataStream ssPeers1 = AddrmanToStream(addrmanUncorrupted);
10261025
bool exceptionThrown = false;
1027-
CAddrMan addrman1(/* deterministic */ false, /* consistency_check_ratio */ 100);
1026+
CAddrMan addrman1(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 100);
10281027

10291028
BOOST_CHECK(addrman1.size() == 0);
10301029
try {
@@ -1041,7 +1040,7 @@ BOOST_AUTO_TEST_CASE(caddrdb_read)
10411040
// Test that CAddrDB::Read creates an addrman with the correct number of addrs.
10421041
CDataStream ssPeers2 = AddrmanToStream(addrmanUncorrupted);
10431042

1044-
CAddrMan addrman2(/* deterministic */ false, /* consistency_check_ratio */ 100);
1043+
CAddrMan addrman2(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 100);
10451044
BOOST_CHECK(addrman2.size() == 0);
10461045
BOOST_CHECK(CAddrDB::Read(addrman2, ssPeers2));
10471046
BOOST_CHECK(addrman2.size() == 3);
@@ -1055,7 +1054,7 @@ BOOST_AUTO_TEST_CASE(caddrdb_read_corrupted)
10551054
// Test that the de-serialization of corrupted addrman throws an exception.
10561055
CDataStream ssPeers1 = AddrmanToStream(addrmanCorrupted);
10571056
bool exceptionThrown = false;
1058-
CAddrMan addrman1(/* deterministic */ false, /* consistency_check_ratio */ 100);
1057+
CAddrMan addrman1(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 100);
10591058
BOOST_CHECK(addrman1.size() == 0);
10601059
try {
10611060
unsigned char pchMsgTmp[4];
@@ -1071,7 +1070,7 @@ BOOST_AUTO_TEST_CASE(caddrdb_read_corrupted)
10711070
// Test that CAddrDB::Read fails if peers.dat is corrupt
10721071
CDataStream ssPeers2 = AddrmanToStream(addrmanCorrupted);
10731072

1074-
CAddrMan addrman2(/* deterministic */ false, /* consistency_check_ratio */ 100);
1073+
CAddrMan addrman2(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 100);
10751074
BOOST_CHECK(addrman2.size() == 0);
10761075
BOOST_CHECK(!CAddrDB::Read(addrman2, ssPeers2));
10771076
}

src/test/fuzz/addrman.cpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,11 @@ class CAddrManDeterministic : public CAddrMan
2828
public:
2929
FuzzedDataProvider& m_fuzzed_data_provider;
3030

31-
explicit CAddrManDeterministic(FuzzedDataProvider& fuzzed_data_provider)
32-
: CAddrMan(/* deterministic */ true, /* consistency_check_ratio */ 0)
31+
explicit CAddrManDeterministic(std::vector<bool> asmap, FuzzedDataProvider& fuzzed_data_provider)
32+
: CAddrMan(std::move(asmap), /* deterministic */ true, /* consistency_check_ratio */ 0)
3333
, m_fuzzed_data_provider(fuzzed_data_provider)
3434
{
3535
WITH_LOCK(cs, insecure_rand = FastRandomContext{ConsumeUInt256(fuzzed_data_provider)});
36-
if (fuzzed_data_provider.ConsumeBool()) {
37-
m_asmap = ConsumeRandomLengthBitVector(fuzzed_data_provider);
38-
if (!SanityCheckASMap(m_asmap)) {
39-
m_asmap.clear();
40-
}
41-
}
4236
}
4337

4438
/**
@@ -224,11 +218,19 @@ class CAddrManDeterministic : public CAddrMan
224218
}
225219
};
226220

221+
[[nodiscard]] inline std::vector<bool> ConsumeAsmap(FuzzedDataProvider& fuzzed_data_provider) noexcept
222+
{
223+
std::vector<bool> asmap = ConsumeRandomLengthBitVector(fuzzed_data_provider);
224+
if (!SanityCheckASMap(asmap)) asmap.clear();
225+
return asmap;
226+
}
227+
227228
FUZZ_TARGET_INIT(addrman, initialize_addrman)
228229
{
229230
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
230231
SetMockTime(ConsumeTime(fuzzed_data_provider));
231-
auto addr_man_ptr = std::make_unique<CAddrManDeterministic>(fuzzed_data_provider);
232+
std::vector<bool> asmap = ConsumeAsmap(fuzzed_data_provider);
233+
auto addr_man_ptr = std::make_unique<CAddrManDeterministic>(asmap, fuzzed_data_provider);
232234
if (fuzzed_data_provider.ConsumeBool()) {
233235
const std::vector<uint8_t> serialized_data{ConsumeRandomLengthByteVector(fuzzed_data_provider)};
234236
CDataStream ds(serialized_data, SER_DISK, INIT_PROTO_VERSION);
@@ -237,7 +239,7 @@ FUZZ_TARGET_INIT(addrman, initialize_addrman)
237239
try {
238240
ds >> *addr_man_ptr;
239241
} catch (const std::ios_base::failure&) {
240-
addr_man_ptr = std::make_unique<CAddrManDeterministic>(fuzzed_data_provider);
242+
addr_man_ptr = std::make_unique<CAddrManDeterministic>(asmap, fuzzed_data_provider);
241243
}
242244
}
243245
CAddrManDeterministic& addr_man = *addr_man_ptr;
@@ -306,9 +308,9 @@ FUZZ_TARGET_INIT(addrman_serdeser, initialize_addrman)
306308
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
307309
SetMockTime(ConsumeTime(fuzzed_data_provider));
308310

309-
CAddrManDeterministic addr_man1{fuzzed_data_provider};
310-
CAddrManDeterministic addr_man2{fuzzed_data_provider};
311-
addr_man2.m_asmap = addr_man1.m_asmap;
311+
std::vector<bool> asmap = ConsumeAsmap(fuzzed_data_provider);
312+
CAddrManDeterministic addr_man1{asmap, fuzzed_data_provider};
313+
CAddrManDeterministic addr_man2{asmap, fuzzed_data_provider};
312314

313315
CDataStream data_stream(SER_NETWORK, PROTOCOL_VERSION);
314316

0 commit comments

Comments
 (0)