CLI: Only one Request Handler can be specified. Previously it was possible to specify multiple, however only one was picked in this arbitrary and (probably) undocumented priority: getinfo > netinfo > generate > addrinfo.

Github-Pull: #27815
Rebased-From: 244e6c8db8
This commit is contained in:
Brotcrunsher 2023-06-04 02:06:11 +02:00 committed by Luke Dashjr
parent 42af9596ce
commit 468087b183

View File

@ -955,6 +955,14 @@ static int CommandLineRPC(int argc, char *argv[])
fputc('\n', stdout);
}
}
int nRh = 0;
if (gArgs.IsArgSet("-getinfo")) nRh++;
if (gArgs.GetBoolArg("-netinfo", false)) nRh++;
if (gArgs.GetBoolArg("-generate", false)) nRh++;
if (gArgs.GetBoolArg("-addrinfo", false)) nRh++;
if (nRh > 1) {
throw std::runtime_error("Only one of \"-getinfo\", \"-netinfo\", \"-generate\", and \"-addrinfo\" may be specified.");
}
std::unique_ptr<BaseRequestHandler> rh;
std::string method;
if (gArgs.IsArgSet("-getinfo")) {