banman: pass the banfile path in

There's no need to hard-code the path here. Passing it in means that there are
no ordering concerns wrt establishing the datadir.
This commit is contained in:
Cory Fields
2017-10-05 13:35:20 -04:00
committed by Carl Dong
parent 4c0d961eb0
commit 2e56702ece
7 changed files with 15 additions and 18 deletions

View File

@@ -105,19 +105,18 @@ bool DeserializeFileDB(const fs::path& path, Data& data)
}
CBanDB::CBanDB()
CBanDB::CBanDB(fs::path ban_list_path) : m_ban_list_path(std::move(ban_list_path))
{
pathBanlist = GetDataDir() / "banlist.dat";
}
bool CBanDB::Write(const banmap_t& banSet)
{
return SerializeFileDB("banlist", pathBanlist, banSet);
return SerializeFileDB("banlist", m_ban_list_path, banSet);
}
bool CBanDB::Read(banmap_t& banSet)
{
return DeserializeFileDB(pathBanlist, banSet);
return DeserializeFileDB(m_ban_list_path, banSet);
}
CAddrDB::CAddrDB()