banman: pass in default ban time as a parameter

Removes the dependency on arg parsing.
This commit is contained in:
Cory Fields
2017-10-05 13:41:45 -04:00
committed by Carl Dong
parent 2e56702ece
commit d0469b2e93
5 changed files with 9 additions and 8 deletions

View File

@@ -537,7 +537,7 @@ void BanMan::Ban(const CSubNet& subNet, const BanReason &banReason, int64_t bant
banEntry.banReason = banReason;
if (bantimeoffset <= 0)
{
bantimeoffset = gArgs.GetArg("-bantime", DEFAULT_MISBEHAVING_BANTIME);
bantimeoffset = m_default_ban_time;
sinceUnixEpoch = false;
}
banEntry.nBanUntil = (sinceUnixEpoch ? 0 : GetTime() )+bantimeoffset;
@@ -2430,7 +2430,7 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
return true;
}
BanMan::BanMan(fs::path ban_file, CClientUIInterface* client_interface) : clientInterface(client_interface), m_ban_db(std::move(ban_file))
BanMan::BanMan(fs::path ban_file, CClientUIInterface* client_interface, int64_t default_ban_time) : clientInterface(client_interface), m_ban_db(std::move(ban_file)), m_default_ban_time(default_ban_time)
{
if (clientInterface) clientInterface->InitMessage(_("Loading banlist..."));