mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02: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:
parent
1f7695b419
commit
dcfef277b4
2 changed files with 7 additions and 1 deletions
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue