Skip to content

Commit cd5622d

Browse files
committed
Make bitcoind invalid argument error message specific
The current message is not helpful. Hardly anyone even remembers that bitcoind used to be a cli utility, let alone new users. Print what the actual problem is.
1 parent 7e96ecf commit cd5622d

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/bitcoind.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,17 +117,14 @@ bool AppInit(int argc, char* argv[])
117117
return false;
118118
}
119119

120-
// Command-line RPC
121-
bool fCommandLine = false;
122-
for (int i = 1; i < argc; i++)
123-
if (!IsSwitchChar(argv[i][0]) && !boost::algorithm::istarts_with(argv[i], "bitcoin:"))
124-
fCommandLine = true;
125-
126-
if (fCommandLine)
127-
{
128-
fprintf(stderr, "Error: There is no RPC client functionality in bitcoind anymore. Use the bitcoin-cli utility instead.\n");
129-
exit(EXIT_FAILURE);
120+
// Error out when loose non-argument tokens are encountered on command line
121+
for (int i = 1; i < argc; i++) {
122+
if (!IsSwitchChar(argv[i][0])) {
123+
fprintf(stderr, "Error: Command line contains unexpected token '%s', see bitcoind -h for a list of options.\n", argv[i]);
124+
exit(EXIT_FAILURE);
125+
}
130126
}
127+
131128
// -server defaults to true for bitcoind but not for the GUI so do this here
132129
SoftSetBoolArg("-server", true);
133130
// Set this early so that parameter interactions go to console

0 commit comments

Comments
 (0)