diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-08-21 15:20:00 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-09-09 09:12:12 +0200 |
commit | fa4e2ccfd8ae96c381947285bef47cb39474ac89 (patch) | |
tree | df8e09e36ea5ddd58345736a6efc6692015b1e0a | |
parent | fa5aeec80c6cdca9ca027d80dff3b397911ff2c2 (diff) | |
download | bitcoin-fa4e2ccfd8ae96c381947285bef47cb39474ac89.tar.xz |
Inline ReadPeerAddresses
No need to have a function that is only called in one place
-rw-r--r-- | src/addrdb.cpp | 9 | ||||
-rw-r--r-- | src/addrdb.h | 1 |
2 files changed, 2 insertions, 8 deletions
diff --git a/src/addrdb.cpp b/src/addrdb.cpp index fd85e717e3..77f0897a7f 100644 --- a/src/addrdb.cpp +++ b/src/addrdb.cpp @@ -177,12 +177,6 @@ bool DumpPeerAddresses(const ArgsManager& args, const CAddrMan& addr) return SerializeFileDB("peers", pathAddr, addr, CLIENT_VERSION); } -bool ReadPeerAddresses(const ArgsManager& args, CAddrMan& addr) -{ - const auto pathAddr = args.GetDataDirNet() / "peers.dat"; - return DeserializeFileDB(pathAddr, addr, CLIENT_VERSION); -} - bool ReadFromStream(CAddrMan& addr, CDataStream& ssPeers) { return DeserializeDB(ssPeers, addr, false); @@ -194,7 +188,8 @@ std::optional<bilingual_str> LoadAddrman(const std::vector<bool>& asmap, const A addrman = std::make_unique<CAddrMan>(asmap, /* deterministic */ false, /* consistency_check_ratio */ check_addrman); int64_t nStart = GetTimeMillis(); - if (ReadPeerAddresses(args, *addrman)) { + const auto path_addr{args.GetDataDirNet() / "peers.dat"}; + if (DeserializeFileDB(path_addr, *addrman, CLIENT_VERSION)) { LogPrintf("Loaded %i addresses from peers.dat %dms\n", addrman->size(), GetTimeMillis() - nStart); } else { // Addrman can be in an inconsistent state after failure, reset it diff --git a/src/addrdb.h b/src/addrdb.h index 99d8a975f4..55fcd7508f 100644 --- a/src/addrdb.h +++ b/src/addrdb.h @@ -20,7 +20,6 @@ class CDataStream; struct bilingual_str; bool DumpPeerAddresses(const ArgsManager& args, const CAddrMan& addr); -bool ReadPeerAddresses(const ArgsManager& args, CAddrMan& addr); /** Only used by tests. */ bool ReadFromStream(CAddrMan& addr, CDataStream& ssPeers); |