aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoin-cli.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2017-11-17 14:11:02 +0100
committerWladimir J. van der Laan <[email protected]>2017-11-17 15:11:50 +0100
commitdcfef277b4920552f438c110390a5de93892a8de (patch)
tree8083a2d49b45dbd081862a8fd0fad7318cd07ecc /src/bitcoin-cli.cpp
parentMerge #11621: [build] Add temp_bitcoin_locale_qrc to CLEAN_QT to fix make dis... (diff)
downloaddiscoin-dcfef277b4920552f438c110390a5de93892a8de.tar.xz
discoin-dcfef277b4920552f438c110390a5de93892a8de.zip
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 5e3b76a29..136981b70 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));