aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-05-02 17:09:25 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2017-05-02 18:41:58 +0200
commitfaf2dea5ea811196ac2291d5369dd0b3621989a6 (patch)
treef6419688769c11c8ce016ef82ca389c5efecc30b /src
parenta3e756b7d61010654abe5cd4694b3f356a8b4606 (diff)
parentd6732d832aa901e733e63799260d409821a2c37a (diff)
downloadbitcoin-faf2dea5ea811196ac2291d5369dd0b3621989a6.tar.xz
Merge #10234: [net] listbanned RPC and QT should show correct banned subnets
d6732d8 [tests] update disconnect_ban.py test case to work with listbanned (John Newbery) 77c54b2 [net] listbanned RPC and QT should show correct banned subnets (John Newbery) Tree-SHA512: edd0e43377d456260d2697213c2829f8483630f3a668b6707d52605faefa610d951d10e6f22a95eff483cbd14faa8ac9b69fa7d3c0b5735c5f3df23fd71282e0
Diffstat (limited to 'src')
-rw-r--r--src/net.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 50b192e2ca..ed4c752606 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
}