The generate RPC has no default numblocks and a numeric value is required.
Update RPC generate help for numblocks to include required #6631
pull ChainQuery wants to merge 1 commits into bitcoin:master from ChainQuery:master changing 1 files +1 −1-
ChainQuery commented at 5:29 PM on September 3, 2015: none
-
e83df075f9
Update RPC generate help for numblocks to include required
The `generate` RPC has no default `numblocks` and a numeric value is required.
-
ChainQuery commented at 5:45 PM on September 3, 2015: none
Re-submission of #6609 - sorry for the double request.
-
paveljanik commented at 5:59 PM on September 3, 2015: contributor
@laanwj Continuing from #6609. Being explicit is nice goal. But in this case, setting default to 1 is much better because regtest/testnet is being used by people who should know what they are doing.
When calling
generate, they expect to generate some blocks. In almost all cases (at least this is my usage), one block. So after callinggeneratewithout arguments, they should reasonably expect at least one block generated (and they see its hash in the returned array).Setting the default to one can speed their work (or at least mine), as usually one block is enough.
But if you really NACK setting the default to 1, my ACK here, of course. No problem with such decision.
-
ChainQuery commented at 2:13 AM on September 4, 2015: none
@paveljanik I agree that when calling
generatethe expectation would be blocks generated, however there are varying expected default values: some folks may expect 1 block , a wallet developer might be expecting 6 blocks, and a miner might be expecting 100.I like the idea of being explicit in this case, just my 0.02 bits...
-
paveljanik commented at 4:59 AM on September 4, 2015: contributor
@ChainQuery after forgetting that miner won't probably mine his blocks using
generateon regtest but on testnet, even miner has to test other counts of blocks being generated. But the common case in every case you mentioned is one. Generating one block is a typical use-case for every type of user you mentioned. A miner (see above...) will test 99 blocks and then one to see a difference. Wallet developer will test 5 blocks and then one (if he is testing displaying the number of confirmations, he will even generate one by one...).But as I said above, I can live with being explicit. But the UX lecture told me to do something when you can expect something to happen and you can't broke anything with it.
-
laanwj commented at 8:44 AM on September 4, 2015: member
@paveljanik For a user-facing UI I'd probably have agreed. But this is an API. Let's not have a bikeshedding discussion about a call that's only used for testing. It's not like adding '1' in a test script is a big drain on anyone's time.
- laanwj merged this on Sep 4, 2015
- laanwj closed this on Sep 4, 2015
- laanwj referenced this in commit 4b437b227c on Sep 4, 2015
- luke-jr referenced this in commit 4b1af0c257 on Jan 9, 2016
- zkbot referenced this in commit 8713d73daf on Dec 18, 2019
- zkbot referenced this in commit 2da77edbfe on Dec 18, 2019
- zkbot referenced this in commit 577f7ef72a on Dec 18, 2019
- MarcoFalke locked this on Sep 8, 2021