mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
cli: Reject arguments to -getinfo
Currently it's possible to accidentally type e.g.
bitcoin-cli -getinfo getbalance
and get an answer which can be confusing; the trialing arguments are
just ignored.
To avoid this, throw an error if the user provides arguments to
`-getinfo`.
This commit is contained in:
@@ -213,6 +213,9 @@ public:
|
||||
/** Create a simulated `getinfo` request. */
|
||||
UniValue PrepareRequest(const std::string& method, const std::vector<std::string>& args) override
|
||||
{
|
||||
if (!args.empty()) {
|
||||
throw std::runtime_error("-getinfo takes no arguments");
|
||||
}
|
||||
UniValue result(UniValue::VARR);
|
||||
result.push_back(JSONRPCRequestObj("getnetworkinfo", NullUniValue, ID_NETWORKINFO));
|
||||
result.push_back(JSONRPCRequestObj("getblockchaininfo", NullUniValue, ID_BLOCKCHAININFO));
|
||||
|
||||
Reference in New Issue
Block a user