From dcfef277b4920552f438c110390a5de93892a8de Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Fri, 17 Nov 2017 14:11:02 +0100 Subject: 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`. --- src/bitcoin-cli.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 5e3b76a295..136981b709 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -213,6 +213,9 @@ public: /** Create a simulated `getinfo` request. */ UniValue PrepareRequest(const std::string& method, const std::vector& 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)); -- cgit v1.2.3