p2p, rpc: don't allow past absolute timestamp in setban

This commit is contained in:
brunoerg
2023-01-05 15:11:32 -03:00
parent adc41cf3b2
commit b99f1f20f7
2 changed files with 7 additions and 0 deletions

View File

@@ -741,6 +741,10 @@ static RPCHelpMan setban()
const bool absolute{request.params[3].isNull() ? false : request.params[3].get_bool()};
if (absolute && banTime < GetTime()) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Error: Absolute timestamp is in the past");
}
if (isSubnet) {
node.banman->Ban(subNet, banTime, absolute);
if (node.connman) {