From 9d2b73d19f97d37517ed3526ab959b1aa405d525 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 28 Nov 2013 17:28:27 +0100 Subject: [PATCH] bitcoin-cli: Add missing SelectParamsFromCommandLine The SelectParamsFromCommandLine call was missing in bitcoin-cli, which caused `-testnet` and `-regtest` to be ignored. Add this call just like in bitcoind.cpp. --- src/bitcoin-cli.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index e4a648e98..4e6594746 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -7,6 +7,7 @@ #include "init.h" #include "rpcclient.h" #include "ui_interface.h" /* for _(...) */ +#include "chainparams.h" #include @@ -26,6 +27,11 @@ static bool AppInitRPC(int argc, char* argv[]) return false; } ReadConfigFile(mapArgs, mapMultiArgs); + // Check for -testnet or -regtest parameter (TestNet() calls are only valid after this clause) + if (!SelectParamsFromCommandLine()) { + fprintf(stderr, "Error: Invalid combination of -regtest and -testnet.\n"); + return false; + } if (argc<2 || mapArgs.count("-?") || mapArgs.count("--help")) {