Skip to content

Commit a8c1ea5

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#26919: scripted-diff: use RPCArg::Optional::OMITTED over OMITTED_NAMED_ARG
83f70c8 doc: improve doc for RPCArg::Optional::OMITTED (fanquake) ea8c7da scripted-diff: use RPCArg::Optional::OMITTED over OMITTED_NAMED_ARG (fanquake) Pull request description: Remove deprecated `RPCArg::Optional::OMITTED_NAMED_ARG` in favour of `OMITTED`. ACKs for top commit: kouloumos: re-ACK 83f70c8 aureleoules: ACK 83f70c8 Tree-SHA512: caba82c0f9f7969d7534bdcdcdfd80b94c16750598343ce63af28e0d579bfd49405bf28acd66dbc6c9a720f040b0e146a5efdff79ebc5ac7364dab54ab16c4a6
2 parents f99b856 + 83f70c8 commit a8c1ea5

15 files changed

+59
-64
lines changed

src/rpc/blockchain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2307,7 +2307,7 @@ static RPCHelpMan scanblocks()
23072307
RPCArg{"start_height", RPCArg::Type::NUM, RPCArg::Default{0}, "Height to start to scan from"},
23082308
RPCArg{"stop_height", RPCArg::Type::NUM, RPCArg::DefaultHint{"chain tip"}, "Height to stop to scan"},
23092309
RPCArg{"filtertype", RPCArg::Type::STR, RPCArg::Default{BlockFilterTypeName(BlockFilterType::BASIC)}, "The type name of the filter"},
2310-
RPCArg{"options", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "",
2310+
RPCArg{"options", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
23112311
{
23122312
{"filter_false_positives", RPCArg::Type::BOOL, RPCArg::Default{false}, "Filter false positives (slower and may fail on pruned nodes). Otherwise they may occur at a rate of 1/M"},
23132313
},

src/rpc/mining.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ static RPCHelpMan prioritisetransaction()
441441
"Accepts the transaction into mined blocks at a higher (or lower) priority\n",
442442
{
443443
{"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id."},
444-
{"dummy", RPCArg::Type::NUM, RPCArg::Optional::OMITTED_NAMED_ARG, "API-Compatibility for previous API. Must be zero or null.\n"
444+
{"dummy", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "API-Compatibility for previous API. Must be zero or null.\n"
445445
" DEPRECATED. For forward compatibility use named arguments and omit this parameter."},
446446
{"fee_delta", RPCArg::Type::NUM, RPCArg::Optional::NO, "The fee value (in satoshis) to add (or subtract, if negative).\n"
447447
" Note, that this value is not a fee rate. It is a value to modify absolute fee of the TX.\n"
@@ -513,8 +513,8 @@ static RPCHelpMan getblocktemplate()
513513
{
514514
{"template_request", RPCArg::Type::OBJ, RPCArg::Default{UniValue::VOBJ}, "Format of the template",
515515
{
516-
{"mode", RPCArg::Type::STR, /* treat as named arg */ RPCArg::Optional::OMITTED_NAMED_ARG, "This must be set to \"template\", \"proposal\" (see BIP 23), or omitted"},
517-
{"capabilities", RPCArg::Type::ARR, /* treat as named arg */ RPCArg::Optional::OMITTED_NAMED_ARG, "A list of strings",
516+
{"mode", RPCArg::Type::STR, /* treat as named arg */ RPCArg::Optional::OMITTED, "This must be set to \"template\", \"proposal\" (see BIP 23), or omitted"},
517+
{"capabilities", RPCArg::Type::ARR, /* treat as named arg */ RPCArg::Optional::OMITTED, "A list of strings",
518518
{
519519
{"str", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "client side supported feature, 'longpoll', 'coinbasevalue', 'proposal', 'serverlist', 'workid'"},
520520
}},

src/rpc/node.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,11 @@ static RPCHelpMan logging()
240240
" - \"none\", \"0\" : even if other logging categories are specified, ignore all of them.\n"
241241
,
242242
{
243-
{"include", RPCArg::Type::ARR, RPCArg::Optional::OMITTED_NAMED_ARG, "The categories to add to debug logging",
243+
{"include", RPCArg::Type::ARR, RPCArg::Optional::OMITTED, "The categories to add to debug logging",
244244
{
245245
{"include_category", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "the valid logging category"},
246246
}},
247-
{"exclude", RPCArg::Type::ARR, RPCArg::Optional::OMITTED_NAMED_ARG, "The categories to remove from debug logging",
247+
{"exclude", RPCArg::Type::ARR, RPCArg::Optional::OMITTED, "The categories to remove from debug logging",
248248
{
249249
{"exclude_category", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "the valid logging category"},
250250
}},
@@ -294,16 +294,16 @@ static RPCHelpMan echo(const std::string& name)
294294
"\nThe difference between echo and echojson is that echojson has argument conversion enabled in the client-side table in "
295295
"bitcoin-cli and the GUI. There is no server-side difference.",
296296
{
297-
{"arg0", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "", RPCArgOptions{.skip_type_check = true}},
298-
{"arg1", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "", RPCArgOptions{.skip_type_check = true}},
299-
{"arg2", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "", RPCArgOptions{.skip_type_check = true}},
300-
{"arg3", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "", RPCArgOptions{.skip_type_check = true}},
301-
{"arg4", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "", RPCArgOptions{.skip_type_check = true}},
302-
{"arg5", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "", RPCArgOptions{.skip_type_check = true}},
303-
{"arg6", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "", RPCArgOptions{.skip_type_check = true}},
304-
{"arg7", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "", RPCArgOptions{.skip_type_check = true}},
305-
{"arg8", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "", RPCArgOptions{.skip_type_check = true}},
306-
{"arg9", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "", RPCArgOptions{.skip_type_check = true}},
297+
{"arg0", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "", RPCArgOptions{.skip_type_check = true}},
298+
{"arg1", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "", RPCArgOptions{.skip_type_check = true}},
299+
{"arg2", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "", RPCArgOptions{.skip_type_check = true}},
300+
{"arg3", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "", RPCArgOptions{.skip_type_check = true}},
301+
{"arg4", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "", RPCArgOptions{.skip_type_check = true}},
302+
{"arg5", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "", RPCArgOptions{.skip_type_check = true}},
303+
{"arg6", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "", RPCArgOptions{.skip_type_check = true}},
304+
{"arg7", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "", RPCArgOptions{.skip_type_check = true}},
305+
{"arg8", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "", RPCArgOptions{.skip_type_check = true}},
306+
{"arg9", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "", RPCArgOptions{.skip_type_check = true}},
307307
},
308308
RPCResult{RPCResult::Type::ANY, "", "Returns whatever was passed in"},
309309
RPCExamples{""},
@@ -376,7 +376,7 @@ static RPCHelpMan getindexinfo()
376376
return RPCHelpMan{"getindexinfo",
377377
"\nReturns the status of one or all available indices currently running in the node.\n",
378378
{
379-
{"index_name", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "Filter results for an index with a specific name."},
379+
{"index_name", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "Filter results for an index with a specific name."},
380380
},
381381
RPCResult{
382382
RPCResult::Type::OBJ_DYN, "", "", {

src/rpc/output_script.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ static RPCHelpMan deriveaddresses()
230230
"For more information on output descriptors, see the documentation in the doc/descriptors.md file.\n"},
231231
{
232232
{"descriptor", RPCArg::Type::STR, RPCArg::Optional::NO, "The descriptor."},
233-
{"range", RPCArg::Type::RANGE, RPCArg::Optional::OMITTED_NAMED_ARG, "If a ranged descriptor is used, this specifies the end or the range (in [begin,end] notation) to derive."},
233+
{"range", RPCArg::Type::RANGE, RPCArg::Optional::OMITTED, "If a ranged descriptor is used, this specifies the end or the range (in [begin,end] notation) to derive."},
234234
},
235235
RPCResult{
236236
RPCResult::Type::ARR, "", "",

src/rpc/rawtransaction.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static RPCHelpMan getrawtransaction()
187187
{"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
188188
{"verbosity|verbose", RPCArg::Type::NUM, RPCArg::Default{0}, "0 for hex-encoded data, 1 for a JSON object, and 2 for JSON object with fee and prevout",
189189
RPCArgOptions{.skip_type_check = true}},
190-
{"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED_NAMED_ARG, "The block in which to look for the transaction"},
190+
{"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "The block in which to look for the transaction"},
191191
},
192192
{
193193
RPCResult{"if verbosity is not set or set to 0",
@@ -639,7 +639,7 @@ static RPCHelpMan signrawtransactionwithkey()
639639
{"privatekey", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "private key in base58-encoding"},
640640
},
641641
},
642-
{"prevtxs", RPCArg::Type::ARR, RPCArg::Optional::OMITTED_NAMED_ARG, "The previous dependent transaction outputs",
642+
{"prevtxs", RPCArg::Type::ARR, RPCArg::Optional::OMITTED, "The previous dependent transaction outputs",
643643
{
644644
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
645645
{
@@ -1578,7 +1578,7 @@ static RPCHelpMan utxoupdatepsbt()
15781578
"\nUpdates all segwit inputs and outputs in a PSBT with data from output descriptors, the UTXO set or the mempool.\n",
15791579
{
15801580
{"psbt", RPCArg::Type::STR, RPCArg::Optional::NO, "A base64 string of a PSBT"},
1581-
{"descriptors", RPCArg::Type::ARR, RPCArg::Optional::OMITTED_NAMED_ARG, "An array of either strings or objects", {
1581+
{"descriptors", RPCArg::Type::ARR, RPCArg::Optional::OMITTED, "An array of either strings or objects", {
15821582
{"", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "An output descriptor"},
15831583
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "An object with an output descriptor and extra information", {
15841584
{"desc", RPCArg::Type::STR, RPCArg::Optional::NO, "An output descriptor"},

src/rpc/server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ static RPCHelpMan stop()
168168
// to the client (intended for testing)
169169
"\nRequest a graceful shutdown of " PACKAGE_NAME ".",
170170
{
171-
{"wait", RPCArg::Type::NUM, RPCArg::Optional::OMITTED_NAMED_ARG, "how long to wait in ms", RPCArgOptions{.hidden=true}},
171+
{"wait", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "how long to wait in ms", RPCArgOptions{.hidden=true}},
172172
},
173173
RPCResult{RPCResult::Type::STR, "", "A string with the content '" + RESULT + "'"},
174174
RPCExamples{""},

src/rpc/txoutproof.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static RPCHelpMan gettxoutproof()
3434
{"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "A transaction hash"},
3535
},
3636
},
37-
{"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED_NAMED_ARG, "If specified, looks for txid in the block with this hash"},
37+
{"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "If specified, looks for txid in the block with this hash"},
3838
},
3939
RPCResult{
4040
RPCResult::Type::STR, "data", "A string that is a serialized, hex-encoded data for the proof."

src/rpc/util.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,6 @@ std::string RPCArg::ToDescriptionString(bool is_named_arg) const
788788
ret += ", optional, default=" + std::get<RPCArg::Default>(m_fallback).write();
789789
} else {
790790
switch (std::get<RPCArg::Optional>(m_fallback)) {
791-
case RPCArg::Optional::OMITTED_NAMED_ARG: // Deprecated alias for OMITTED, can be removed
792791
case RPCArg::Optional::OMITTED: {
793792
if (is_named_arg) ret += ", optional"; // Default value is "null" in dicts. Otherwise,
794793
// nothing to do. Element is treated as if not present and has no default value

src/rpc/util.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,14 @@ struct RPCArg {
154154
/** Required arg */
155155
NO,
156156
/**
157-
* The arg is optional for one of two reasons:
158-
*
159-
* Optional arg that is a named argument and has a default value of
160-
* `null`.
161-
*
162-
* Optional argument with default value omitted because they are
163-
* implicitly clear. That is, elements in an array may not
164-
* exist by default.
157+
* Optional argument for which the default value is omitted from
158+
* help text for one of two reasons:
159+
* - It's a named argument and has a default value of `null`.
160+
* - Its default value is implicitly clear. That is, elements in an
161+
* array may not exist by default.
165162
* When possible, the default value should be specified.
166163
*/
167164
OMITTED,
168-
OMITTED_NAMED_ARG, // Deprecated alias for OMITTED, can be removed
169165
};
170166
/** Hint for default value */
171167
using DefaultHint = std::string;

src/wallet/rpc/addresses.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ RPCHelpMan addmultisigaddress()
226226
{"key", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "bitcoin address or hex-encoded public key"},
227227
},
228228
},
229-
{"label", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "A label to assign the addresses to."},
229+
{"label", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "A label to assign the addresses to."},
230230
{"address_type", RPCArg::Type::STR, RPCArg::DefaultHint{"set by -addresstype"}, "The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\"."},
231231
},
232232
RPCResult{
@@ -696,7 +696,7 @@ RPCHelpMan listlabels()
696696
return RPCHelpMan{"listlabels",
697697
"\nReturns the list of all labels, or labels that are assigned to addresses with a specific purpose.\n",
698698
{
699-
{"purpose", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "Address purpose to list labels for ('send','receive'). An empty string is the same as not providing this argument."},
699+
{"purpose", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "Address purpose to list labels for ('send','receive'). An empty string is the same as not providing this argument."},
700700
},
701701
RPCResult{
702702
RPCResult::Type::ARR, "", "",

0 commit comments

Comments
 (0)