mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-04 13:55:23 -05:00
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)
This commit is contained in:
parent
1b313cacc9
commit
fa19bb2cd8
4 changed files with 3 additions and 13 deletions
|
@ -16,9 +16,6 @@
|
||||||
|
|
||||||
static UniValue rpcNestedTest_rpc(const JSONRPCRequest& request)
|
static UniValue rpcNestedTest_rpc(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
if (request.fHelp) {
|
|
||||||
return "help message";
|
|
||||||
}
|
|
||||||
return request.params.write(0, 0);
|
return request.params.write(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -242,12 +242,7 @@ static RPCHelpMan generatetodescriptor()
|
||||||
static RPCHelpMan generate()
|
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 {
|
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());
|
throw JSONRPCError(RPC_METHOD_NOT_FOUND, self.ToString());
|
||||||
}
|
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -624,8 +624,6 @@ static RPCHelpMan echo(const std::string& name)
|
||||||
RPCExamples{""},
|
RPCExamples{""},
|
||||||
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
|
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
|
||||||
{
|
{
|
||||||
if (request.fHelp) throw std::runtime_error(self.ToString());
|
|
||||||
|
|
||||||
if (request.params[9].isStr()) {
|
if (request.params[9].isStr()) {
|
||||||
CHECK_NONFATAL(request.params[9].get_str() != "trigger_internal_bug");
|
CHECK_NONFATAL(request.params[9].get_str() != "trigger_internal_bug");
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,10 +262,10 @@ static RPCHelpMan addnode()
|
||||||
std::string strCommand;
|
std::string strCommand;
|
||||||
if (!request.params[1].isNull())
|
if (!request.params[1].isNull())
|
||||||
strCommand = request.params[1].get_str();
|
strCommand = request.params[1].get_str();
|
||||||
if (request.fHelp || request.params.size() != 2 ||
|
if (strCommand != "onetry" && strCommand != "add" && strCommand != "remove") {
|
||||||
(strCommand != "onetry" && strCommand != "add" && strCommand != "remove"))
|
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
self.ToString());
|
self.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
NodeContext& node = EnsureNodeContext(request.context);
|
NodeContext& node = EnsureNodeContext(request.context);
|
||||||
if(!node.connman)
|
if(!node.connman)
|
||||||
|
@ -604,7 +604,7 @@ static RPCHelpMan setban()
|
||||||
std::string strCommand;
|
std::string strCommand;
|
||||||
if (!request.params[1].isNull())
|
if (!request.params[1].isNull())
|
||||||
strCommand = request.params[1].get_str();
|
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());
|
throw std::runtime_error(help.ToString());
|
||||||
}
|
}
|
||||||
NodeContext& node = EnsureNodeContext(request.context);
|
NodeContext& node = EnsureNodeContext(request.context);
|
||||||
|
|
Loading…
Add table
Reference in a new issue