mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 14:08:40 +01:00
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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user