Skip to content

Commit 77c54b2

Browse files
committed
[net] listbanned RPC and QT should show correct banned subnets
1 parent cb007e4 commit 77c54b2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/net.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,10 +418,10 @@ void CConnman::DumpBanlist()
418418

419419
CBanDB bandb;
420420
banmap_t banmap;
421-
SetBannedSetDirty(false);
422421
GetBanned(banmap);
423-
if (!bandb.Write(banmap))
424-
SetBannedSetDirty(true);
422+
if (bandb.Write(banmap)) {
423+
SetBannedSetDirty(false);
424+
}
425425

426426
LogPrint(BCLog::NET, "Flushed %d banned node ips/subnets to banlist.dat %dms\n",
427427
banmap.size(), GetTimeMillis() - nStart);
@@ -541,6 +541,8 @@ bool CConnman::Unban(const CSubNet &subNet) {
541541
void CConnman::GetBanned(banmap_t &banMap)
542542
{
543543
LOCK(cs_setBanned);
544+
// Sweep the banlist so expired bans are not returned
545+
SweepBanned();
544546
banMap = setBanned; //create a thread safe copy
545547
}
546548

0 commit comments

Comments
 (0)