aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2021-08-24 11:27:05 +0100
committerJohn Newbery <john@johnnewbery.com>2021-08-27 10:55:41 +0100
commitf572f2b2048994b3b50f4cfd5de19e40b1acfb22 (patch)
treef81adee0eac69d5d99be3b8b4f8b1f9e756169f6 /src/init.cpp
parent593247872decd6d483a76e96d79433247226ad14 (diff)
downloadbitcoin-f572f2b2048994b3b50f4cfd5de19e40b1acfb22.tar.xz
[addrman] Set m_asmap in CAddrMan initializer list
This allows us to make it const.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 78025517f0..b744298667 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1201,8 +1201,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
}
auto check_addrman = std::clamp<int32_t>(args.GetArg("-checkaddrman", DEFAULT_ADDRMAN_CONSISTENCY_CHECKS), 0, 1000000);
- node.addrman = std::make_unique<CAddrMan>(/* deterministic */ false, /* consistency_check_ratio */ check_addrman);
- node.addrman->m_asmap = asmap;
+ node.addrman = std::make_unique<CAddrMan>(asmap, /* deterministic */ false, /* consistency_check_ratio */ check_addrman);
// Load addresses from peers.dat
uiInterface.InitMessage(_("Loading P2P addresses…").translated);
@@ -1212,8 +1211,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
LogPrintf("Loaded %i addresses from peers.dat %dms\n", node.addrman->size(), GetTimeMillis() - nStart);
} else {
// Addrman can be in an inconsistent state after failure, reset it
- node.addrman = std::make_unique<CAddrMan>(/* deterministic */ false, /* consistency_check_ratio */ check_addrman);
- node.addrman->m_asmap = asmap;
+ node.addrman = std::make_unique<CAddrMan>(asmap, /* deterministic */ false, /* consistency_check_ratio */ check_addrman);
LogPrintf("Recreating peers.dat\n");
adb.Write(*node.addrman);
}