diff options
author | Pieter Wuille <pieter@wuille.net> | 2020-06-10 17:11:38 -0700 |
---|---|---|
committer | Pieter Wuille <pieter@wuille.net> | 2020-07-03 20:43:55 -0700 |
commit | 2ad58381fffb33d611abf900b73d9e6b5a4e35f8 (patch) | |
tree | 8794dd741e4616bcf129da6e274a822a9952e53b /src/rpc/net.cpp | |
parent | b691f2df5f7d443c0c9ee056ab94aa0fc19566d5 (diff) |
Clean up separated ban/discourage interface
Diffstat (limited to 'src/rpc/net.cpp')
-rw-r--r-- | src/rpc/net.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index c0738152d6..393442e946 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -601,8 +601,7 @@ static UniValue setban(const JSONRPCRequest& request) if (strCommand == "add") { - if ((isSubnet && node.banman->IsBanned(subNet)) || - (!isSubnet && node.banman->IsBannedLevel(netAddr) == BanReasonManuallyAdded)) { + if (isSubnet ? node.banman->IsBanned(subNet) : node.banman->IsBanned(netAddr)) { throw JSONRPCError(RPC_CLIENT_NODE_ALREADY_ADDED, "Error: IP/Subnet already banned"); } @@ -615,12 +614,12 @@ static UniValue setban(const JSONRPCRequest& request) absolute = true; if (isSubnet) { - node.banman->Ban(subNet, BanReasonManuallyAdded, banTime, absolute); + node.banman->Ban(subNet, banTime, absolute); if (node.connman) { node.connman->DisconnectNode(subNet); } } else { - node.banman->Ban(netAddr, BanReasonManuallyAdded, banTime, absolute); + node.banman->Ban(netAddr, banTime, absolute); if (node.connman) { node.connman->DisconnectNode(netAddr); } |