refactor: Get rid of BanMan::SetBannedSetDirty()

This commit is contained in:
Hennadii Stepanov 2022-01-18 19:18:02 +02:00
parent d88c0d8440
commit 46709c5f27
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
2 changed files with 3 additions and 10 deletions

View file

@ -55,12 +55,13 @@ void BanMan::DumpBanlist()
SweepBanned();
if (!m_is_dirty) return;
banmap = m_banned;
SetBannedSetDirty(false);
m_is_dirty = false;
}
int64_t n_start = GetTimeMillis();
if (!m_ban_db.Write(banmap)) {
SetBannedSetDirty(true);
LOCK(m_cs_banned);
m_is_dirty = true;
}
LogPrint(BCLog::NET, "Flushed %d banned node addresses/subnets to disk %dms\n", banmap.size(),
@ -202,9 +203,3 @@ void BanMan::SweepBanned()
m_client_interface->BannedListChanged();
}
}
void BanMan::SetBannedSetDirty(bool dirty)
{
LOCK(m_cs_banned); //reuse m_banned lock for the m_is_dirty flag
m_is_dirty = dirty;
}

View file

@ -81,8 +81,6 @@ public:
private:
void LoadBanlist() EXCLUSIVE_LOCKS_REQUIRED(!m_cs_banned);
//!set the "dirty" flag for the banlist
void SetBannedSetDirty(bool dirty = true);
//!clean unused entries (if bantime has expired)
void SweepBanned() EXCLUSIVE_LOCKS_REQUIRED(m_cs_banned);