Closes: #29555
Simply adds an additional suggestion to check bitcoin-cli -help.
Closes: #29555
Simply adds an additional suggestion to check bitcoin-cli -help.
Adds a string suggestion `bitcoin-cli -help` as an additional source of
information.
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
For detailed information about the code coverage, see the test coverage report.
<!--021abf342d371248e50ceaed478a90ca-->
See the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
lgtm ACK 69d6fd676e9c15ef41a03722d51ed0b13c3e4320
826 | @@ -827,7 +827,10 @@ static UniValue CallRPC(BaseRequestHandler* rh, const std::string& strMethod, co 827 | if (response.error != -1) { 828 | responseErrorMessage = strprintf(" (error code %d - \"%s\")", response.error, http_errorstring(response.error)); 829 | } 830 | - throw CConnectionFailed(strprintf("Could not connect to the server %s:%d%s\n\nMake sure the bitcoind server is running and that you are connecting to the correct RPC port.", host, port, responseErrorMessage)); 831 | + throw CConnectionFailed(strprintf("Could not connect to the server %s:%d%s\n\n" 832 | + "Make sure the bitcoind server is running and that you are connecting to the correct RPC port.\n" 833 | + "Use \"bitcoin-cli -help\" for more info.", 834 | + host, port, responseErrorMessage));
3 tabs eh? :)
I suggest conforming with the throw-statement following the one being changed - putting the initial string literal on a new line and keep to one tab indentation.
throw CConnectionFailed(strprintf(
"Could not connect to the server %s:%d%s\n\n"
"Make sure the bitcoind server is running and that you are connecting to the correct RPC port.\n"
"Use \"bitcoin-cli -help\" for more info.",
host, port, responseErrorMessage));
clang-format-diff has other ideas:
throw CConnectionFailed(strprintf("Could not connect to the server %s:%d%s\n\n"
"Make sure the bitcoind server is running and that you are connecting to the correct RPC port.\n"
"Use \"bitcoin-cli -help\" for more info.",
host, port, responseErrorMessage));
Not sure where the 3 tabs came from, as my check script is supposed to run that... I guess was my editor default somehow though.
@cbergqvist Generally, the style is left to the pull request author and usually not changed, unless someone else touches it. Also, tabs \t are not allowed in C++ code in this repo. If there were any, the CI should have failed.
I regret the initial tone of my comment but I'm happy clang-format came up with something reasonable.
Sure, no worries :)
826 | @@ -827,7 +827,10 @@ static UniValue CallRPC(BaseRequestHandler* rh, const std::string& strMethod, co 827 | if (response.error != -1) { 828 | responseErrorMessage = strprintf(" (error code %d - \"%s\")", response.error, http_errorstring(response.error)); 829 | } 830 | - throw CConnectionFailed(strprintf("Could not connect to the server %s:%d%s\n\nMake sure the bitcoind server is running and that you are connecting to the correct RPC port.", host, port, responseErrorMessage)); 831 | + throw CConnectionFailed(strprintf("Could not connect to the server %s:%d%s\n\n" 832 | + "Make sure the bitcoind server is running and that you are connecting to the correct RPC port.\n" 833 | + "Use \"bitcoin-cli -help\" for more info.",
nit: ++specificity
"Use \"bitcoin-cli -help\" for more connection info.",
I think "connection info" might be less accurate here?
Was thinking the user might be missing -rpcport, -rpcconnect or -signet (different default port), but not -generate -netinfo or -stdin. Maybe -signet is not something one would classify as "connection info" though, making it less accurate as you say.
This is one of the first errors users are likely to encounter, so I support making it a bit more helpful.
ACK for 69d6fd676e9c15ef41a03722d51ed0b13c3e4320
Good light-touch approach to address Issue #29555. Executed, and the output looks good:
$ src/bitcoin-cli help
error: timeout on transient error: Could not connect to the server 127.0.0.1:8332
Make sure the bitcoind server is running and that you are connecting to the correct RPC port.
Use "bitcoin-cli -help" for more info.
Just to be thorough: Pulled the pr branch, built, ran all unit and functional tests (all passed) before executing.
ack 69d6fd676e9c15ef41a03722d51ed0b13c3e4320
tested ACK 69d6fd676e9c15ef41a03722d51ed0b13c3e4320
This a reasonable way for both reporting the connection failure, plus guiding the user on how to get more help on bitcoin-cli.
bitcoind already running is confirmed:% src/bitcoin-cli help
error: timeout on transient error: Could not connect to the server 127.0.0.1:18332
Make sure the bitcoind server is running and that you are connecting to the correct RPC port.
Use "bitcoin-cli -help" for more info.
--with-incompatible-bdb and --enable-suppress-external-warningsmake check and all tests passtest/functional/test_runner.py --extended and all tests pass