-
Notifications
You must be signed in to change notification settings - Fork 37.7k
rpc generate: print useful help and error message #19455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rpc generate: print useful help and error message #19455
Conversation
Tagging @adamjonas and @MarcoFalke who suggested this feature. |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
260b7c2
to
210873d
Compare
Thanks Jonas! Good point -- updated. EDIT: per review feedback below, changed it to a hidden RPC command, which won't shown up in the general |
8804531
to
68fe377
Compare
68fe377
to
14e2a82
Compare
14e2a82
to
f0aa8ae
Compare
No ACKs. Closing. |
This is my fault for the slow review, but I still think it's a useful addition to reduce confusion for all the outdated tutorials out there [1, 2, 3, 4]. tACK f0aa8ae Tried
This is much more instructive than the method not found error.
And verified that it is a hidden RPC command I'm still an advocate for including this for the poor, unfortunate souls out there just trying to get started on regtest. |
Thanks for the review @adamjonas. Re-opening to see if this gets traction. |
Concept / code review ACK. LGTM No strong opinion, but an alternative might be to PR an update on those outdated docs, and/or ping the respective authors. Perhaps both; ping and merge. |
Thanks @adamjonas and @kallewoof ❤️ Good idea; I notified on the bitcoin.org github a couple months ago that If the maintainers agree on this change, ISTM the 2 ACKs and the test coverage here may enough to merge this no-risk user-facing aid. |
# Consider RPC generate covered, because it is overloaded in | ||
# test_framework/test_node.py and not seen by the coverage check. | ||
covered_cmds = set({'generate'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite understand this. generate
is not returned by help
and so I don't think its even added to the coverage list:
help_output = node.help().split('\n') |
Both with and without this change, my coverage results were the same:
Uncovered RPC commands:
- pruneblockchain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pinheadmz Yes, it's a hidden command (not in the help, see the added test) as suggested by @laanwj. IIRC this was needed to appease a failing check in the Travis CI that despite the added test it thought there was no coverage.
Concept ACK Built and tested locally, all behavior is as expected trying different combinations:
Only thing that caught me as far as interface is the fact that there is |
They are principally different on purpose. Like for any UNIX-ish application, On the other hand, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK f0aa8ae
Thanks for your answers to my questions @jonatack and @laanwj
Show Signature
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
ACK f0aa8aeea5a183ea44a877255d12db7732f2e0a8
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEE5hdzzW4BBA4vG9eM5+KYS2KJyToFAl80EaUACgkQ5+KYS2KJ
yTrkBw//dEwEnhDeko2ScTnzl/4mZSJLR0KG4D//BhWq+bhsSKKslWUQDMdJDYE/
HljPiuButxN01vJOVowqYV6ZGIPEVLiILu/R7OYkU81KLUPtZwsaouT9b0/8opmZ
/uXysTqvUa9UUfrk01vxkU63+viAQdpe5WBaf6dURdBjodRdoxL41r60GhMlacoe
wS75MuzR+pojiyr/Wf9s+t2BKDVO79rhoClhdOo9xiud4kqomdpmyQh2/86T5moe
LgTOjufZGAl/0haI1EAlWmtw0+AjMl6hRnrVUcgblElOJ201HZoE2Qj0L8bkykU1
I890Cu28PFWFeeK6xX3ev/ja6v2iLzrq1VsKmH1WRkEYaOkL8GvH4MJHwuQSlsFS
/h+dxMFjPvmigZMQTuaHDtDrsRGLqMTd6WEYoIC/NKRK+7UjgpGjzSiiRBS4g7iB
pVTTpei9/zjvXwlvr427+ji1kbWt2YKQdqrDeMIHHc5gcsFY9E1vgSKDw94TjVyt
YwOHlYG+ezhULsxNbW/D40ox1veFDkK/I0DkHN0AcUP7RuKTTdAiZ4B6+Fturk0f
3eFNIxf3qilCy5LPfRBcqtQ8GkpVgvcDpsO83cEeffyTIxrtRrPDULRc0upI81Jd
mi6DrhAultLW1xFvAjB8EBTTEVrdg9doVD5vMqHM+CFGm+wnyvM=
=wdk/
-----END PGP SIGNATURE-----
pinheadmz's public key is on keybase
Thanks @pinheadmz! |
f0aa8ae test: add rpc_generate functional test (Jon Atack) 92d94ff rpc: print useful help and error message for generate (Jon Atack) 8d32d20 test: consider generate covered in _get_uncovered_rpc_commands() (Jon Atack) Pull request description: This was a requested follow-up to bitcoin#19133 and bitcoin#17700 to alleviate confusion and head-scratching by people following tutorials that use `generate`. See bitcoin#19455 (comment) below, bitcoin#19133 (comment) and bitcoin#17700 (comment). before ``` $ bitcoin-cli help generate help: unknown command: generate $ bitcoin-cli generate error code: -32601 error message: Method not found ``` after ``` $ bitcoin-cli help generate generate ( nblocks maxtries ) has been replaced by the -generate cli option. Refer to -help for more information. $ bitcoin-cli generate error code: -32601 error message: generate ( nblocks maxtries ) has been replaced by the -generate cli option. Refer to -help for more information. ``` In the general help it remains hidden, as requested by laanwj. ``` $ bitcoin-cli help == Generating == generateblock "output" ["rawtx/txid",...] generatetoaddress nblocks "address" ( maxtries ) generatetodescriptor num_blocks "descriptor" ( maxtries ) ``` ACKs for top commit: adamjonas: utACK f0aa8ae pinheadmz: ACK f0aa8ae Tree-SHA512: d083652589ad3e8228c733455245001db22397559c3946e7e573cf9bd01c46e9e88b72d934728ec7f4361436ae4c74adb8f579670b09f479011924357e729af5
Summary: PR rationale: > This was a requested follow-up to #19133 and #17700 to alleviate confusion and head-scratching by people following tutorials that use `generate`. > test: consider generate covered in _get_uncovered_rpc_commands() > rpc: print useful help and error message for generate > test: add rpc_generate functional test This is a backport of [[ bitcoin/bitcoin#19455 | core#19455 ]] Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Subscribers: Fabien Differential Revision: https://reviews.bitcoinabc.org/D10091
This was a requested follow-up to #19133 and #17700 to alleviate confusion and head-scratching by people following tutorials that use
generate
. See #19455 (comment) below, #19133 (comment) and #17700 (comment).before
after
In the general help it remains hidden, as requested by laanwj.