aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-09-22 19:08:36 +0200
committerMarcoFalke <falke.marco@gmail.com>2020-09-24 19:53:24 +0200
commitfa19bb2cd8c575593583138a84e6bb3444d6196d (patch)
treeaf0a4278e9139cbc524a284115e9e4d8aaa4294f
parent1b313cacc99a1b372238f9036abed5491f9d28f7 (diff)
downloadbitcoin-fa19bb2cd8c575593583138a84e6bb3444d6196d.tar.xz
remove dead rpc code
Checking for fHelp, or the size of the args, is dead code because: * fHelp is always false (src/qt/test/rpcnestedtests.cpp) * It is already implicitly called by RPCHelpMan::Check (src/rpc/mining.cpp, src/rpc/misc.cpp, src/rpc/net.cpp)
-rw-r--r--src/qt/test/rpcnestedtests.cpp3
-rw-r--r--src/rpc/mining.cpp5
-rw-r--r--src/rpc/misc.cpp2
-rw-r--r--src/rpc/net.cpp6
4 files changed, 3 insertions, 13 deletions
diff --git a/src/qt/test/rpcnestedtests.cpp b/src/qt/test/rpcnestedtests.cpp
index de1fbcb94c..e2b94223a2 100644
--- a/src/qt/test/rpcnestedtests.cpp
+++ b/src/qt/test/rpcnestedtests.cpp
@@ -16,9 +16,6 @@
static UniValue rpcNestedTest_rpc(const JSONRPCRequest& request)
{
- if (request.fHelp) {
- return "help message";
- }
return request.params.write(0, 0);
}
diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp
index b04e106b2d..9d40f0e988 100644
--- a/src/rpc/mining.cpp
+++ b/src/rpc/mining.cpp
@@ -242,12 +242,7 @@ static RPCHelpMan generatetodescriptor()
static RPCHelpMan generate()
{
return RPCHelpMan{"generate", "has been replaced by the -generate cli option. Refer to -help for more information.", {}, {}, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue {
-
- if (request.fHelp) {
- throw std::runtime_error(self.ToString());
- } else {
throw JSONRPCError(RPC_METHOD_NOT_FOUND, self.ToString());
- }
}};
}
diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp
index 0c982317f5..b3102a236d 100644
--- a/src/rpc/misc.cpp
+++ b/src/rpc/misc.cpp
@@ -624,8 +624,6 @@ static RPCHelpMan echo(const std::string& name)
RPCExamples{""},
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
- if (request.fHelp) throw std::runtime_error(self.ToString());
-
if (request.params[9].isStr()) {
CHECK_NONFATAL(request.params[9].get_str() != "trigger_internal_bug");
}
diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp
index 11a2d23d85..a7dfd2453d 100644
--- a/src/rpc/net.cpp
+++ b/src/rpc/net.cpp
@@ -262,10 +262,10 @@ static RPCHelpMan addnode()
std::string strCommand;
if (!request.params[1].isNull())
strCommand = request.params[1].get_str();
- if (request.fHelp || request.params.size() != 2 ||
- (strCommand != "onetry" && strCommand != "add" && strCommand != "remove"))
+ if (strCommand != "onetry" && strCommand != "add" && strCommand != "remove") {
throw std::runtime_error(
self.ToString());
+ }
NodeContext& node = EnsureNodeContext(request.context);
if(!node.connman)
@@ -604,7 +604,7 @@ static RPCHelpMan setban()
std::string strCommand;
if (!request.params[1].isNull())
strCommand = request.params[1].get_str();
- if (request.fHelp || !help.IsValidNumArgs(request.params.size()) || (strCommand != "add" && strCommand != "remove")) {
+ if (strCommand != "add" && strCommand != "remove") {
throw std::runtime_error(help.ToString());
}
NodeContext& node = EnsureNodeContext(request.context);