aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-08-21 11:22:21 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-09-07 11:05:16 +0200
commitfade9a1a4db71241ccad03fdacfb626453952963 (patch)
tree08c9e5b360cd324eac820a7600cfc39707be9ec2 /src/init.cpp
parentfa7f77b7d1709bf35808fced0d67b6e97b784d63 (diff)
downloadbitcoin-fade9a1a4db71241ccad03fdacfb626453952963.tar.xz
Remove confusing CAddrDB
The class only stores the file path, reading it from a global. Globals are confusing and make testing harder. The method reading from a stream does not even use any class members, so putting it in a class is also confusing.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/init.cpp b/src/init.cpp
index b744298667..2869cf4daf 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1206,14 +1206,13 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
// Load addresses from peers.dat
uiInterface.InitMessage(_("Loading P2P addresses…").translated);
int64_t nStart = GetTimeMillis();
- CAddrDB adb;
- if (adb.Read(*node.addrman)) {
+ if (ReadPeerAddresses(args, *node.addrman)) {
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>(asmap, /* deterministic */ false, /* consistency_check_ratio */ check_addrman);
LogPrintf("Recreating peers.dat\n");
- adb.Write(*node.addrman);
+ DumpPeerAddresses(args, *node.addrman);
}
}