Skip to content

Commit 9d2b73d

Browse files
committed
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.
1 parent 4ae42d4 commit 9d2b73d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/bitcoin-cli.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "init.h"
88
#include "rpcclient.h"
99
#include "ui_interface.h" /* for _(...) */
10+
#include "chainparams.h"
1011

1112
#include <boost/filesystem/operations.hpp>
1213

@@ -26,6 +27,11 @@ static bool AppInitRPC(int argc, char* argv[])
2627
return false;
2728
}
2829
ReadConfigFile(mapArgs, mapMultiArgs);
30+
// Check for -testnet or -regtest parameter (TestNet() calls are only valid after this clause)
31+
if (!SelectParamsFromCommandLine()) {
32+
fprintf(stderr, "Error: Invalid combination of -regtest and -testnet.\n");
33+
return false;
34+
}
2935

3036
if (argc<2 || mapArgs.count("-?") || mapArgs.count("--help"))
3137
{

0 commit comments

Comments
 (0)