diff options
author | brunoerg <brunoely.gc@gmail.com> | 2023-01-05 15:11:32 -0300 |
---|---|---|
committer | brunoerg <brunoely.gc@gmail.com> | 2023-01-06 13:33:38 -0300 |
commit | b99f1f20f773eb55c870a033b3f2e8f13d55d0c8 (patch) | |
tree | 57c825644070f8f7901b6cefdfd51b6647e424d7 /src/rpc/net.cpp | |
parent | adc41cf3b22f8f168e88ce3ad5f27c1130f12beb (diff) |
p2p, rpc: don't allow past absolute timestamp in `setban`
Diffstat (limited to 'src/rpc/net.cpp')
-rw-r--r-- | src/rpc/net.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index 4611e03270..d430087358 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -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) { |