mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
setban: rewrite to UniValue, allow absolute bantime
This commit is contained in:
@@ -484,15 +484,15 @@ bool CNode::IsBanned(CSubNet subnet)
|
||||
return fResult;
|
||||
}
|
||||
|
||||
void CNode::Ban(const CNetAddr& addr, int64_t bantimeoffset) {
|
||||
void CNode::Ban(const CNetAddr& addr, int64_t bantimeoffset, bool sinceUnixEpoch) {
|
||||
CSubNet subNet(addr.ToString()+(addr.IsIPv4() ? "/32" : "/128"));
|
||||
Ban(subNet, bantimeoffset);
|
||||
Ban(subNet, bantimeoffset, sinceUnixEpoch);
|
||||
}
|
||||
|
||||
void CNode::Ban(const CSubNet& subNet, int64_t bantimeoffset) {
|
||||
void CNode::Ban(const CSubNet& subNet, int64_t bantimeoffset, bool sinceUnixEpoch) {
|
||||
int64_t banTime = GetTime()+GetArg("-bantime", 60*60*24); // Default 24-hour ban
|
||||
if (bantimeoffset > 0)
|
||||
banTime = GetTime()+bantimeoffset;
|
||||
banTime = (sinceUnixEpoch ? 0 : GetTime() )+bantimeoffset;
|
||||
|
||||
LOCK(cs_setBanned);
|
||||
if (setBanned[subNet] < banTime)
|
||||
|
||||
Reference in New Issue
Block a user