refactor: Remove redundant scope in BanMan::SweepBanned()

This commit is contained in:
Hennadii Stepanov 2022-05-20 15:20:42 +02:00
parent 52c0b3e859
commit ab75388320
No known key found for this signature in database
GPG key ID: 410108112E7EA81F

View file

@ -183,20 +183,20 @@ void BanMan::SweepBanned()
int64_t now = GetTime(); int64_t now = GetTime();
bool notify_ui = false; bool notify_ui = false;
{ banmap_t::iterator it = m_banned.begin();
banmap_t::iterator it = m_banned.begin(); while (it != m_banned.end()) {
while (it != m_banned.end()) { CSubNet sub_net = (*it).first;
CSubNet sub_net = (*it).first; CBanEntry ban_entry = (*it).second;
CBanEntry ban_entry = (*it).second; if (!sub_net.IsValid() || now > ban_entry.nBanUntil) {
if (!sub_net.IsValid() || now > ban_entry.nBanUntil) { m_banned.erase(it++);
m_banned.erase(it++); m_is_dirty = true;
m_is_dirty = true; notify_ui = true;
notify_ui = true; LogPrint(BCLog::NET, "Removed banned node address/subnet: %s\n", sub_net.ToString());
LogPrint(BCLog::NET, "Removed banned node address/subnet: %s\n", sub_net.ToString()); } else {
} else ++it;
++it;
} }
} }
// update UI // update UI
if (notify_ui && m_client_interface) { if (notify_ui && m_client_interface) {
m_client_interface->BannedListChanged(); m_client_interface->BannedListChanged();