diff options
author | Pieter Wuille <pieter@wuille.net> | 2020-06-10 17:11:38 -0700 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2020-07-08 09:10:52 +0800 |
commit | 2b79ac740622218a52e2cf3ae1755dd3a8d4847a (patch) | |
tree | 10ee4ea03b0960eab263bcfcf9cfb8253264194c /src/rpc | |
parent | 04773480575ac79f238ac5764247dddd0cae5051 (diff) | |
download | bitcoin-2b79ac740622218a52e2cf3ae1755dd3a8d4847a.tar.xz |
Clean up separated ban/discourage interface
Github-Pull: #19219
Rebased-From: 2ad58381fffb33d611abf900b73d9e6b5a4e35f8
Diffstat (limited to 'src/rpc')
-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 3886efcadf..8c400c05a0 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -591,8 +591,7 @@ static UniValue setban(const JSONRPCRequest& request) if (strCommand == "add") { - if ((isSubnet && g_rpc_node->banman->IsBanned(subNet)) || - (!isSubnet && g_rpc_node->banman->IsBannedLevel(netAddr) == BanReasonManuallyAdded)) { + if (isSubnet ? g_rpc_node->banman->IsBanned(subNet) : g_rpc_node->banman->IsBanned(netAddr)) { throw JSONRPCError(RPC_CLIENT_NODE_ALREADY_ADDED, "Error: IP/Subnet already banned"); } @@ -605,12 +604,12 @@ static UniValue setban(const JSONRPCRequest& request) absolute = true; if (isSubnet) { - g_rpc_node->banman->Ban(subNet, BanReasonManuallyAdded, banTime, absolute); + g_rpc_node->banman->Ban(subNet, banTime, absolute); if (g_rpc_node->connman) { g_rpc_node->connman->DisconnectNode(subNet); } } else { - g_rpc_node->banman->Ban(netAddr, BanReasonManuallyAdded, banTime, absolute); + g_rpc_node->banman->Ban(netAddr, banTime, absolute); if (g_rpc_node->connman) { g_rpc_node->connman->DisconnectNode(netAddr); } |