mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
Inline ReadPeerAddresses
No need to have a function that is only called in one place
This commit is contained in:
parent
fa5aeec80c
commit
fa4e2ccfd8
2 changed files with 2 additions and 8 deletions
|
@ -177,12 +177,6 @@ bool DumpPeerAddresses(const ArgsManager& args, const CAddrMan& addr)
|
||||||
return SerializeFileDB("peers", pathAddr, addr, CLIENT_VERSION);
|
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)
|
bool ReadFromStream(CAddrMan& addr, CDataStream& ssPeers)
|
||||||
{
|
{
|
||||||
return DeserializeDB(ssPeers, addr, false);
|
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);
|
addrman = std::make_unique<CAddrMan>(asmap, /* deterministic */ false, /* consistency_check_ratio */ check_addrman);
|
||||||
|
|
||||||
int64_t nStart = GetTimeMillis();
|
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);
|
LogPrintf("Loaded %i addresses from peers.dat %dms\n", addrman->size(), GetTimeMillis() - nStart);
|
||||||
} else {
|
} else {
|
||||||
// Addrman can be in an inconsistent state after failure, reset it
|
// Addrman can be in an inconsistent state after failure, reset it
|
||||||
|
|
|
@ -20,7 +20,6 @@ class CDataStream;
|
||||||
struct bilingual_str;
|
struct bilingual_str;
|
||||||
|
|
||||||
bool DumpPeerAddresses(const ArgsManager& args, const CAddrMan& addr);
|
bool DumpPeerAddresses(const ArgsManager& args, const CAddrMan& addr);
|
||||||
bool ReadPeerAddresses(const ArgsManager& args, CAddrMan& addr);
|
|
||||||
/** Only used by tests. */
|
/** Only used by tests. */
|
||||||
bool ReadFromStream(CAddrMan& addr, CDataStream& ssPeers);
|
bool ReadFromStream(CAddrMan& addr, CDataStream& ssPeers);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue