aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorPhilip Kaufmann <phil.kaufmann@t-online.de>2015-07-03 09:44:49 +0200
committerPhilip Kaufmann <phil.kaufmann@t-online.de>2015-10-02 11:38:15 +0200
commitce479aaadaab296f0d06808fe230c4b13523cc28 (patch)
treec34a0e529a34302bcb06dc0f38450f04cde39bd2 /src/net.cpp
parent57c77fe4d318a156d98606ee74f0064b22c31631 (diff)
banlist: better handling of banlist in StartNode()
- only start working on/with banlist data, if reading in the banlist from disk didn't fail - as CNode::setBannedIsDirty is false (default) when reading fails, we don't need to explicitly set it to false to prevent writing banlist.dat in that case either
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/net.cpp b/src/net.cpp
index b13177fe25..6d39ccecdc 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1909,15 +1909,16 @@ void StartNode(boost::thread_group& threadGroup, CScheduler& scheduler)
//try to read stored banlist
CBanDB bandb;
banmap_t banmap;
- if (!bandb.Read(banmap))
+ if (bandb.Read(banmap)) {
+ CNode::SetBanned(banmap); // thread save setter
+ CNode::SetBannedSetDirty(false); // no need to write down, just read data
+ CNode::SweepBanned(); // sweep out unused entries
+
+ LogPrint("net", "Loaded %d banned node ips/subnets from banlist.dat %dms\n",
+ banmap.size(), GetTimeMillis() - nStart);
+ } else
LogPrintf("Invalid or missing banlist.dat; recreating\n");
- CNode::SetBanned(banmap); //thread save setter
- CNode::SetBannedSetDirty(false); //no need to write down just read or nonexistent data
- CNode::SweepBanned(); //sweap out unused entries
-
- LogPrintf("Loaded %i addresses from peers.dat %dms\n",
- addrman.size(), GetTimeMillis() - nStart);
fAddressesInitialized = true;
if (semOutbound == NULL) {