aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2017-10-05 13:35:20 -0400
committerCarl Dong <accounts@carldong.me>2019-01-16 13:54:18 -0500
commit2e56702ecedd83c4b7cb8de9de5c437c8c08e645 (patch)
tree8ceb655d5556a7b97a6362d1940e5b8ae0a307e0 /src/net.cpp
parent4c0d961eb0d7825a1e6f8389d7f5545114ee18c6 (diff)
downloadbitcoin-2e56702ecedd83c4b7cb8de9de5c437c8c08e645.tar.xz
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.
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 5479130320..fd74c58292 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -466,10 +466,9 @@ void BanMan::DumpBanlist()
int64_t nStart = GetTimeMillis();
- CBanDB bandb;
banmap_t banmap;
GetBanned(banmap);
- if (bandb.Write(banmap)) {
+ if (m_ban_db.Write(banmap)) {
SetBannedSetDirty(false);
}
@@ -2431,16 +2430,14 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
return true;
}
-BanMan::BanMan(CClientUIInterface* client_interface) : clientInterface(client_interface)
+BanMan::BanMan(fs::path ban_file, CClientUIInterface* client_interface) : clientInterface(client_interface), m_ban_db(std::move(ban_file))
{
if (clientInterface) clientInterface->InitMessage(_("Loading banlist..."));
- // Load addresses from banlist.dat
int64_t nStart = GetTimeMillis();
setBannedIsDirty = false;
- CBanDB bandb;
banmap_t banmap;
- if (bandb.Read(banmap)) {
+ if (m_ban_db.Read(banmap)) {
SetBanned(banmap); // thread save setter
SetBannedSetDirty(false); // no need to write down, just read data
SweepBanned(); // sweep out unused entries