Skip to content

Commit 85ae549

Browse files
committed
Merge bitcoin/bitcoin#24137: doc: Rework generate* doc
fa30e62 doc: Rework generate* doc (MarcoFalke) Pull request description: Hide the test-only calls and clarify the short description ACKs for top commit: 0xB10C: reACK fa30e62. changes since fa3bb584dcc742a767b2141cd7324877e3cf5302 are: dropping the `immediately` + formatting the touched line and a rebase Tree-SHA512: 07439f39660bbf144c2cc406b6010b64dcdd27150d78654fe04a36a982a519f837a0cf0f030c9f30af69c451ccf7a3b7287a275637aa81904c202029b9efc661
2 parents 72f9728 + fa30e62 commit 85ae549

File tree

3 files changed

+25
-20
lines changed

3 files changed

+25
-20
lines changed

src/bitcoin-cli.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ static void SetupCliArgs(ArgsManager& argsman)
6969
argsman.AddArg("-version", "Print version and exit", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
7070
argsman.AddArg("-conf=<file>", strprintf("Specify configuration file. Relative paths will be prefixed by datadir location. (default: %s)", BITCOIN_CONF_FILENAME), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
7171
argsman.AddArg("-datadir=<dir>", "Specify data directory", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
72-
argsman.AddArg("-generate", strprintf("Generate blocks immediately, equivalent to RPC getnewaddress followed by RPC generatetoaddress. Optional positional integer arguments are number of blocks to generate (default: %s) and maximum iterations to try (default: %s), equivalent to RPC generatetoaddress nblocks and maxtries arguments. Example: bitcoin-cli -generate 4 1000", DEFAULT_NBLOCKS, DEFAULT_MAX_TRIES), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
72+
argsman.AddArg("-generate",
73+
strprintf("Generate blocks, equivalent to RPC getnewaddress followed by RPC generatetoaddress. Optional positional integer "
74+
"arguments are number of blocks to generate (default: %s) and maximum iterations to try (default: %s), equivalent to "
75+
"RPC generatetoaddress nblocks and maxtries arguments. Example: bitcoin-cli -generate 4 1000",
76+
DEFAULT_NBLOCKS, DEFAULT_MAX_TRIES),
77+
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
7378
argsman.AddArg("-addrinfo", "Get the number of addresses known to the node, per network and total.", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
7479
argsman.AddArg("-getinfo", "Get general information from the remote server. Note that unlike server-side RPC calls, the results of -getinfo is the result of multiple non-atomic requests. Some entries in the result may represent results from different states (e.g. wallet balance may be as of a different block from the chain state reported)", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
7580
argsman.AddArg("-netinfo", "Get network peer connection information from the remote server. An optional integer argument from 0 to 4 can be passed for different peers listings (default: 0). Pass \"help\" for detailed help documentation.", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);

src/rpc/mining.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,9 @@ static RPCHelpMan generatetodescriptor()
217217
{
218218
return RPCHelpMan{
219219
"generatetodescriptor",
220-
"\nMine blocks immediately to a specified descriptor (before the RPC call returns)\n",
220+
"Mine to a specified descriptor and return the block hashes.",
221221
{
222-
{"num_blocks", RPCArg::Type::NUM, RPCArg::Optional::NO, "How many blocks are generated immediately."},
222+
{"num_blocks", RPCArg::Type::NUM, RPCArg::Optional::NO, "How many blocks are generated."},
223223
{"descriptor", RPCArg::Type::STR, RPCArg::Optional::NO, "The descriptor to send the newly generated bitcoin to."},
224224
{"maxtries", RPCArg::Type::NUM, RPCArg::Default{DEFAULT_MAX_TRIES}, "How many iterations to try."},
225225
},
@@ -261,18 +261,18 @@ static RPCHelpMan generate()
261261
static RPCHelpMan generatetoaddress()
262262
{
263263
return RPCHelpMan{"generatetoaddress",
264-
"\nMine blocks immediately to a specified address (before the RPC call returns)\n",
265-
{
266-
{"nblocks", RPCArg::Type::NUM, RPCArg::Optional::NO, "How many blocks are generated immediately."},
267-
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The address to send the newly generated bitcoin to."},
268-
{"maxtries", RPCArg::Type::NUM, RPCArg::Default{DEFAULT_MAX_TRIES}, "How many iterations to try."},
269-
},
270-
RPCResult{
271-
RPCResult::Type::ARR, "", "hashes of blocks generated",
272-
{
273-
{RPCResult::Type::STR_HEX, "", "blockhash"},
274-
}},
275-
RPCExamples{
264+
"Mine to a specified address and return the block hashes.",
265+
{
266+
{"nblocks", RPCArg::Type::NUM, RPCArg::Optional::NO, "How many blocks are generated."},
267+
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The address to send the newly generated bitcoin to."},
268+
{"maxtries", RPCArg::Type::NUM, RPCArg::Default{DEFAULT_MAX_TRIES}, "How many iterations to try."},
269+
},
270+
RPCResult{
271+
RPCResult::Type::ARR, "", "hashes of blocks generated",
272+
{
273+
{RPCResult::Type::STR_HEX, "", "blockhash"},
274+
}},
275+
RPCExamples{
276276
"\nGenerate 11 blocks to myaddress\n"
277277
+ HelpExampleCli("generatetoaddress", "11 \"myaddress\"")
278278
+ "If you are using the " PACKAGE_NAME " wallet, you can get a new address to send the newly generated bitcoin to with:\n"
@@ -302,7 +302,7 @@ static RPCHelpMan generatetoaddress()
302302
static RPCHelpMan generateblock()
303303
{
304304
return RPCHelpMan{"generateblock",
305-
"\nMine a block with a set of ordered transactions immediately to a specified address or descriptor (before the RPC call returns)\n",
305+
"Mine a set of ordered transactions to a specified address or descriptor and return the block hash.",
306306
{
307307
{"output", RPCArg::Type::STR, RPCArg::Optional::NO, "The address or descriptor to send the newly generated bitcoin to."},
308308
{"transactions", RPCArg::Type::ARR, RPCArg::Optional::NO, "An array of hex strings which are either txids or raw transactions.\n"
@@ -1278,9 +1278,9 @@ static const CRPCCommand commands[] =
12781278
{ "mining", &submitheader, },
12791279

12801280

1281-
{ "generating", &generatetoaddress, },
1282-
{ "generating", &generatetodescriptor, },
1283-
{ "generating", &generateblock, },
1281+
{ "hidden", &generatetoaddress, },
1282+
{ "hidden", &generatetodescriptor, },
1283+
{ "hidden", &generateblock, },
12841284

12851285
{ "util", &estimatesmartfee, },
12861286

test/functional/rpc_help.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def test_categories(self):
100100
# command titles
101101
titles = [line[3:-3] for line in node.help().splitlines() if line.startswith('==')]
102102

103-
components = ['Blockchain', 'Control', 'Generating', 'Mining', 'Network', 'Rawtransactions', 'Util']
103+
components = ['Blockchain', 'Control', 'Mining', 'Network', 'Rawtransactions', 'Util']
104104

105105
if self.is_wallet_compiled():
106106
components.append('Wallet')

0 commit comments

Comments
 (0)