| 14 | |
| 15 | |
| 16 | BanMan::BanMan(fs::path ban_file, CClientUIInterface* client_interface, int64_t default_ban_time) |
| 17 | : m_client_interface(client_interface), m_ban_db(std::move(ban_file)), m_default_ban_time(default_ban_time) |
| 18 | { |
| 19 | if (m_client_interface) m_client_interface->InitMessage(_("Loading banlist…").translated); |
| 20 | |
| 21 | int64_t n_start = GetTimeMillis(); |
| 22 | if (m_ban_db.Read(m_banned)) { |
| 23 | SweepBanned(); // sweep out unused entries |
| 24 | |
| 25 | LogPrint(BCLog::NET, "Loaded %d banned node addresses/subnets %dms\n", m_banned.size(), |
| 26 | GetTimeMillis() - n_start); |
| 27 | } else { |
| 28 | LogPrintf("Recreating the banlist database\n"); |
| 29 | m_banned = {}; |
| 30 | m_is_dirty = true; |
| 31 | } |
| 32 | |
| 33 | DumpBanlist(); |
| 34 | } |
| 35 | |
| 36 | BanMan::~BanMan() |
| 37 | { |
nothing calls this directly
no test coverage detected