aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2017-04-19 12:49:11 -0400
committerJohn Newbery <john@johnnewbery.com>2017-04-28 11:24:33 -0400
commit77c54b270dd3b469d662c8f69e06f7b00fc4136d (patch)
treebece88821c751bce967fa2c918bf6227974f93c6
parentcb007e4346cf49357d104e08c3ccc027570b734d (diff)
downloadbitcoin-77c54b270dd3b469d662c8f69e06f7b00fc4136d.tar.xz
[net] listbanned RPC and QT should show correct banned subnets
-rw-r--r--src/net.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 27389d6e0c..bd2b177ef3 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -418,10 +418,10 @@ void CConnman::DumpBanlist()
CBanDB bandb;
banmap_t banmap;
- SetBannedSetDirty(false);
GetBanned(banmap);
- if (!bandb.Write(banmap))
- SetBannedSetDirty(true);
+ if (bandb.Write(banmap)) {
+ SetBannedSetDirty(false);
+ }
LogPrint(BCLog::NET, "Flushed %d banned node ips/subnets to banlist.dat %dms\n",
banmap.size(), GetTimeMillis() - nStart);
@@ -541,6 +541,8 @@ bool CConnman::Unban(const CSubNet &subNet) {
void CConnman::GetBanned(banmap_t &banMap)
{
LOCK(cs_setBanned);
+ // Sweep the banlist so expired bans are not returned
+ SweepBanned();
banMap = setBanned; //create a thread safe copy
}