mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-20 13:37:28 +02:00
banman: reformulate nBanUtil calculation
Avoid reassigning parameters.
This commit is contained in:
parent
daae598feb
commit
1ffa4ce27d
1 changed files with 6 additions and 3 deletions
|
|
@ -104,11 +104,14 @@ void BanMan::Ban(const CSubNet& subNet, const BanReason& banReason, int64_t bant
|
||||||
{
|
{
|
||||||
CBanEntry banEntry(GetTime());
|
CBanEntry banEntry(GetTime());
|
||||||
banEntry.banReason = banReason;
|
banEntry.banReason = banReason;
|
||||||
|
|
||||||
|
int64_t normalized_bantimeoffset = bantimeoffset;
|
||||||
|
bool normalized_sinceUnixEpoch = sinceUnixEpoch;
|
||||||
if (bantimeoffset <= 0) {
|
if (bantimeoffset <= 0) {
|
||||||
bantimeoffset = m_default_ban_time;
|
normalized_bantimeoffset = m_default_ban_time;
|
||||||
sinceUnixEpoch = false;
|
normalized_sinceUnixEpoch = false;
|
||||||
}
|
}
|
||||||
banEntry.nBanUntil = (sinceUnixEpoch ? 0 : GetTime()) + bantimeoffset;
|
banEntry.nBanUntil = (normalized_sinceUnixEpoch ? 0 : GetTime()) + normalized_bantimeoffset;
|
||||||
|
|
||||||
{
|
{
|
||||||
LOCK(m_cs_banned);
|
LOCK(m_cs_banned);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue