aboutsummaryrefslogtreecommitdiff
path: root/src/addrdb.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/addrdb.cpp
parentfa7f77b7d1709bf35808fced0d67b6e97b784d63 (diff)
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/addrdb.cpp')
-rw-r--r--src/addrdb.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/addrdb.cpp b/src/addrdb.cpp
index 345dbdfb16..856f318961 100644
--- a/src/addrdb.cpp
+++ b/src/addrdb.cpp
@@ -170,22 +170,19 @@ bool CBanDB::Read(banmap_t& banSet)
return true;
}
-CAddrDB::CAddrDB()
-{
- pathAddr = gArgs.GetDataDirNet() / "peers.dat";
-}
-
-bool CAddrDB::Write(const CAddrMan& addr)
+bool DumpPeerAddresses(const ArgsManager& args, const CAddrMan& addr)
{
+ const auto pathAddr = args.GetDataDirNet() / "peers.dat";
return SerializeFileDB("peers", pathAddr, addr, CLIENT_VERSION);
}
-bool CAddrDB::Read(CAddrMan& addr)
+bool ReadPeerAddresses(const ArgsManager& args, CAddrMan& addr)
{
+ const auto pathAddr = args.GetDataDirNet() / "peers.dat";
return DeserializeFileDB(pathAddr, addr, CLIENT_VERSION);
}
-bool CAddrDB::Read(CAddrMan& addr, CDataStream& ssPeers)
+bool ReadFromStream(CAddrMan& addr, CDataStream& ssPeers)
{
return DeserializeDB(ssPeers, addr, false);
}