Skip to content

Commit e2c473f

Browse files
author
MarcoFalke
committed
Merge #14796: rpc: Pass argument descriptions to RPCHelpMan
fabca42 RPCHelpMan: Add space after colons in extended description (MarcoFalke) fafd040 rpc: Add description to fundrawtransaction vout_index (MarcoFalke) 1db0096 rpc: Pass argument descriptions to RPCHelpMan (MarcoFalke) Pull request description: This will normalize the type names and formatting for the rpc arguments Tree-SHA512: 6ab344882f0fed36046ab4636cb2fa5d2479c6aae22666ca9a0d067edbb9eff8de98010ad97c8ce40ab532d15d1ae67120a561b0bf3da837090d7de427679f4f
2 parents 86ff041 + fabca42 commit e2c473f

File tree

10 files changed

+805
-1036
lines changed

10 files changed

+805
-1036
lines changed

src/rpc/blockchain.cpp

Lines changed: 47 additions & 107 deletions
Large diffs are not rendered by default.

src/rpc/mining.cpp

Lines changed: 33 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,10 @@ static UniValue getnetworkhashps(const JSONRPCRequest& request)
9292
"Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change.\n"
9393
"Pass in [height] to estimate the network speed at the time when a certain block was found.\n",
9494
{
95-
{"nblocks", RPCArg::Type::NUM, true},
96-
{"height", RPCArg::Type::NUM, true},
95+
{"nblocks", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "120", "The number of blocks, or -1 for blocks since last difficulty change."},
96+
{"height", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "-1", "To estimate at the time of the given height."},
9797
}}
9898
.ToString() +
99-
"\nArguments:\n"
100-
"1. nblocks (numeric, optional, default=120) The number of blocks, or -1 for blocks since last difficulty change.\n"
101-
"2. height (numeric, optional, default=-1) To estimate at the time of the given height.\n"
10299
"\nResult:\n"
103100
"x (numeric) Hashes per second estimated\n"
104101
"\nExamples:\n"
@@ -165,15 +162,11 @@ static UniValue generatetoaddress(const JSONRPCRequest& request)
165162
RPCHelpMan{"generatetoaddress",
166163
"\nMine blocks immediately to a specified address (before the RPC call returns)\n",
167164
{
168-
{"nblocks", RPCArg::Type::NUM, false},
169-
{"address", RPCArg::Type::STR, false},
170-
{"maxtries", RPCArg::Type::NUM, true},
165+
{"nblocks", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "How many blocks are generated immediately."},
166+
{"address", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The address to send the newly generated bitcoin to."},
167+
{"maxtries", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "1000000", "How many iterations to try."},
171168
}}
172169
.ToString() +
173-
"\nArguments:\n"
174-
"1. nblocks (numeric, required) How many blocks are generated immediately.\n"
175-
"2. address (string, required) The address to send the newly generated bitcoin to.\n"
176-
"3. maxtries (numeric, optional) How many iterations to try (default = 1000000).\n"
177170
"\nResult:\n"
178171
"[ blockhashes ] (array) hashes of blocks generated\n"
179172
"\nExamples:\n"
@@ -247,19 +240,15 @@ static UniValue prioritisetransaction(const JSONRPCRequest& request)
247240
RPCHelpMan{"prioritisetransaction",
248241
"Accepts the transaction into mined blocks at a higher (or lower) priority\n",
249242
{
250-
{"txid", RPCArg::Type::STR, false},
251-
{"dummy", RPCArg::Type::NUM, false},
252-
{"fee_delta", RPCArg::Type::NUM, false},
253-
}}
254-
.ToString() +
255-
"\nArguments:\n"
256-
"1. \"txid\" (string, required) The transaction id.\n"
257-
"2. dummy (numeric, optional) API-Compatibility for previous API. Must be zero or null.\n"
258-
" DEPRECATED. For forward compatibility use named arguments and omit this parameter.\n"
259-
"3. fee_delta (numeric, required) The fee value (in satoshis) to add (or subtract, if negative).\n"
243+
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction id."},
244+
{"dummy", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "API-Compatibility for previous API. Must be zero or null.\n"
245+
" DEPRECATED. For forward compatibility use named arguments and omit this parameter."},
246+
{"fee_delta", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "The fee value (in satoshis) to add (or subtract, if negative).\n"
260247
" Note, that this value is not a fee rate. It is a value to modify absolute fee of the TX.\n"
261248
" The fee is not actually paid, only the algorithm for selecting transactions into a block\n"
262-
" considers the transaction as it would have paid a higher (or lower) fee.\n"
249+
" considers the transaction as it would have paid a higher (or lower) fee."},
250+
}}
251+
.ToString() +
263252
"\nResult:\n"
264253
"true (boolean) Returns true\n"
265254
"\nExamples:\n"
@@ -322,38 +311,23 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
322311
" https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki#getblocktemplate_changes\n"
323312
" https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki\n",
324313
{
325-
{"template_request", RPCArg::Type::OBJ,
314+
{"template_request", RPCArg::Type::OBJ, /* opt */ true, /* default_val */ "", "A json object in the following spec",
326315
{
327-
{"mode", RPCArg::Type::STR, true},
328-
{"capabilities", RPCArg::Type::ARR,
316+
{"mode", RPCArg::Type::STR, /* opt */ true, /* default_val */ "", "This must be set to \"template\", \"proposal\" (see BIP 23), or omitted"},
317+
{"capabilities", RPCArg::Type::ARR, /* opt */ true, /* default_val */ "", "A list of strings",
329318
{
330-
{"support", RPCArg::Type::STR, true},
319+
{"support", RPCArg::Type::STR, /* opt */ true, /* default_val */ "", "client side supported feature, 'longpoll', 'coinbasetxn', 'coinbasevalue', 'proposal', 'serverlist', 'workid'"},
331320
},
332-
true},
333-
{"rules", RPCArg::Type::ARR,
321+
},
322+
{"rules", RPCArg::Type::ARR, /* opt */ true, /* default_val */ "", "A list of strings",
334323
{
335-
{"support", RPCArg::Type::STR, true},
324+
{"support", RPCArg::Type::STR, /* opt */ true, /* default_val */ "", "client side supported softfork deployment"},
325+
},
336326
},
337-
true},
338327
},
339-
true, "\"template_request\""},
328+
"\"template_request\""},
340329
}}
341330
.ToString() +
342-
"\nArguments:\n"
343-
"1. template_request (json object, optional) A json object in the following spec\n"
344-
" {\n"
345-
" \"mode\":\"template\" (string, optional) This must be set to \"template\", \"proposal\" (see BIP 23), or omitted\n"
346-
" \"capabilities\":[ (array, optional) A list of strings\n"
347-
" \"support\" (string) client side supported feature, 'longpoll', 'coinbasetxn', 'coinbasevalue', 'proposal', 'serverlist', 'workid'\n"
348-
" ,...\n"
349-
" ],\n"
350-
" \"rules\":[ (array, optional) A list of strings\n"
351-
" \"support\" (string) client side supported softfork deployment\n"
352-
" ,...\n"
353-
" ]\n"
354-
" }\n"
355-
"\n"
356-
357331
"\nResult:\n"
358332
"{\n"
359333
" \"version\" : n, (numeric) The preferred block version\n"
@@ -742,13 +716,10 @@ static UniValue submitblock(const JSONRPCRequest& request)
742716
"\nAttempts to submit new block to network.\n"
743717
"See https://en.bitcoin.it/wiki/BIP_0022 for full specification.\n",
744718
{
745-
{"hexdata", RPCArg::Type::STR_HEX, false},
746-
{"dummy", RPCArg::Type::STR, true},
719+
{"hexdata", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "the hex-encoded block data to submit"},
720+
{"dummy", RPCArg::Type::STR, /* opt */ true, /* default_val */ "", "dummy value, for compatibility with BIP22. This value is ignored."},
747721
}}
748722
.ToString() +
749-
"\nArguments\n"
750-
"1. \"hexdata\" (string, required) the hex-encoded block data to submit\n"
751-
"2. \"dummy\" (optional) dummy value, for compatibility with BIP22. This value is ignored.\n"
752723
"\nResult:\n"
753724
"\nExamples:\n"
754725
+ HelpExampleCli("submitblock", "\"mydata\"")
@@ -810,11 +781,9 @@ static UniValue submitheader(const JSONRPCRequest& request)
810781
"\nDecode the given hexdata as a header and submit it as a candidate chain tip if valid."
811782
"\nThrows when the header is invalid.\n",
812783
{
813-
{"hexdata", RPCArg::Type::STR_HEX, false},
784+
{"hexdata", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "the hex-encoded block header data"},
814785
}}
815786
.ToString() +
816-
"\nArguments\n"
817-
"1. \"hexdata\" (string, required) the hex-encoded block header data\n"
818787
"\nResult:\n"
819788
"None"
820789
"\nExamples:\n" +
@@ -852,21 +821,18 @@ static UniValue estimatesmartfee(const JSONRPCRequest& request)
852821
"for which the estimate is valid. Uses virtual transaction size as defined\n"
853822
"in BIP 141 (witness data is discounted).\n",
854823
{
855-
{"conf_target", RPCArg::Type::NUM, false},
856-
{"estimate_mode", RPCArg::Type::STR, true},
857-
}}
858-
.ToString() +
859-
"\nArguments:\n"
860-
"1. conf_target (numeric) Confirmation target in blocks (1 - 1008)\n"
861-
"2. \"estimate_mode\" (string, optional, default=CONSERVATIVE) The fee estimate mode.\n"
824+
{"conf_target", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "Confirmation target in blocks (1 - 1008)"},
825+
{"estimate_mode", RPCArg::Type::STR, /* opt */ true, /* default_val */ "CONSERVATIVE", "The fee estimate mode.\n"
862826
" Whether to return a more conservative estimate which also satisfies\n"
863827
" a longer history. A conservative estimate potentially returns a\n"
864828
" higher feerate and is more likely to be sufficient for the desired\n"
865829
" target, but is not as responsive to short term drops in the\n"
866830
" prevailing fee market. Must be one of:\n"
867831
" \"UNSET\"\n"
868832
" \"ECONOMICAL\"\n"
869-
" \"CONSERVATIVE\"\n"
833+
" \"CONSERVATIVE\""},
834+
}}
835+
.ToString() +
870836
"\nResult:\n"
871837
"{\n"
872838
" \"feerate\" : x.x, (numeric, optional) estimate fee rate in " + CURRENCY_UNIT + "/kB\n"
@@ -921,15 +887,12 @@ static UniValue estimaterawfee(const JSONRPCRequest& request)
921887
"confirmation within conf_target blocks if possible. Uses virtual transaction size as\n"
922888
"defined in BIP 141 (witness data is discounted).\n",
923889
{
924-
{"conf_target", RPCArg::Type::NUM, false},
925-
{"threshold", RPCArg::Type::NUM, true},
890+
{"conf_target", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "Confirmation target in blocks (1 - 1008)"},
891+
{"threshold", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "", "The proportion of transactions in a given feerate range that must have been\n"
892+
" confirmed within conf_target in order to consider those feerates as high enough and proceed to check\n"
893+
" lower buckets. Default: 0.95"},
926894
}}
927895
.ToString() +
928-
"\nArguments:\n"
929-
"1. conf_target (numeric) Confirmation target in blocks (1 - 1008)\n"
930-
"2. threshold (numeric, optional) The proportion of transactions in a given feerate range that must have been\n"
931-
" confirmed within conf_target in order to consider those feerates as high enough and proceed to check\n"
932-
" lower buckets. Default: 0.95\n"
933896
"\nResult:\n"
934897
"{\n"
935898
" \"short\" : { (json object, optional) estimate for short time horizon\n"

0 commit comments

Comments
 (0)