aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoin-cli.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-11-17 14:11:02 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2017-11-17 15:11:50 +0100
commitdcfef277b4920552f438c110390a5de93892a8de (patch)
tree8083a2d49b45dbd081862a8fd0fad7318cd07ecc /src/bitcoin-cli.cpp
parent1f7695b4194bd1d3872c9e91ad9ee271670894ea (diff)
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`.
Diffstat (limited to 'src/bitcoin-cli.cpp')
-rw-r--r--src/bitcoin-cli.cpp3
1 files changed, 3 insertions, 0 deletions
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<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));