Skip to content

Commit ea8b2e8

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#21913: rpc: RPCHelpMan fixes
6e2eb0d rpc/wallet: use OMITTED_NAMED_ARG instead of Default(VNULL) (Karl-Johan Alm) 4983f4c rpc/createwallet: omitted named arguments (Karl-Johan Alm) dc4db23 rpc: address:amount dictionaries are OBJ_USER_KEYS (Karl-Johan Alm) c8cf0a3 rpc/getpeerinfo: bytesrecv_per_msg is a dynamic dictionary (Karl-Johan Alm) eb4fb7e rpc/gettxoutsetinfo: hash_or_height is a named argument (Karl-Johan Alm) Pull request description: This is a follow-up to #21897, and I believe covers the remaining cases, at least that I could find. Edited to remove unrelated information about a side project. ACKs for top commit: laanwj: Documentation diff ACK 6e2eb0d promag: Code review ACK 6e2eb0d. Tree-SHA512: d26f6e074e13d64bbca2a114a0adc7f905d47d238c4e9bc49f70ca0b775afbebf9879fc3794ab29dc316a6dbd00ba8cbeb01197e236ee4ab2e9854db25f23f04
2 parents 7d19c85 + 6e2eb0d commit ea8b2e8

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/rpc/blockchain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ static RPCHelpMan gettxoutsetinfo()
10991099
"Note this call may take some time if you are not using coinstatsindex.\n",
11001100
{
11011101
{"hash_type", RPCArg::Type::STR, RPCArg::Default{"hash_serialized_2"}, "Which UTXO set hash should be calculated. Options: 'hash_serialized_2' (the legacy algorithm), 'muhash', 'none'."},
1102-
{"hash_or_height", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "The block hash or height of the target height (only available with coinstatsindex).", "", {"", "string or numeric"}},
1102+
{"hash_or_height", RPCArg::Type::NUM, RPCArg::Optional::OMITTED_NAMED_ARG, "The block hash or height of the target height (only available with coinstatsindex).", "", {"", "string or numeric"}},
11031103
{"use_index", RPCArg::Type::BOOL, RPCArg::Default{true}, "Use coinstatsindex, if available."},
11041104
},
11051105
RPCResult{

src/rpc/net.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static RPCHelpMan getpeerinfo()
159159
"When a message type is not listed in this json object, the bytes sent are 0.\n"
160160
"Only known message types can appear as keys in the object."}
161161
}},
162-
{RPCResult::Type::OBJ, "bytesrecv_per_msg", "",
162+
{RPCResult::Type::OBJ_DYN, "bytesrecv_per_msg", "",
163163
{
164164
{RPCResult::Type::NUM, "msg", "The total bytes received aggregated by message type\n"
165165
"When a message type is not listed in this json object, the bytes received are 0.\n"

src/rpc/rawtransaction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,7 @@ static RPCHelpMan createpsbt()
14341434
"For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n"
14351435
" accepted as second parameter.",
14361436
{
1437-
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
1437+
{"", RPCArg::Type::OBJ_USER_KEYS, RPCArg::Optional::OMITTED, "",
14381438
{
14391439
{"address", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in " + CURRENCY_UNIT},
14401440
},

src/wallet/rpcwallet.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ static RPCHelpMan sendmany()
854854
HELP_REQUIRING_PASSPHRASE,
855855
{
856856
{"dummy", RPCArg::Type::STR, RPCArg::Optional::NO, "Must be set to \"\" for backwards compatibility.", "\"\""},
857-
{"amounts", RPCArg::Type::OBJ, RPCArg::Optional::NO, "The addresses and amounts",
857+
{"amounts", RPCArg::Type::OBJ_USER_KEYS, RPCArg::Optional::NO, "The addresses and amounts",
858858
{
859859
{"address", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "The bitcoin address is the key, the numeric amount (can be string) in " + CURRENCY_UNIT + " is the value"},
860860
},
@@ -2568,7 +2568,7 @@ static RPCHelpMan loadwallet()
25682568
"\napplied to the new wallet (eg -rescan, etc).\n",
25692569
{
25702570
{"filename", RPCArg::Type::STR, RPCArg::Optional::NO, "The wallet directory or .dat file."},
2571-
{"load_on_startup", RPCArg::Type::BOOL, RPCArg::Default{UniValue::VNULL}, "Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged."},
2571+
{"load_on_startup", RPCArg::Type::BOOL, RPCArg::Optional::OMITTED_NAMED_ARG, "Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged."},
25722572
},
25732573
RPCResult{
25742574
RPCResult::Type::OBJ, "", "",
@@ -2696,10 +2696,10 @@ static RPCHelpMan createwallet()
26962696
{"wallet_name", RPCArg::Type::STR, RPCArg::Optional::NO, "The name for the new wallet. If this is a path, the wallet will be created at the path location."},
26972697
{"disable_private_keys", RPCArg::Type::BOOL, RPCArg::Default{false}, "Disable the possibility of private keys (only watchonlys are possible in this mode)."},
26982698
{"blank", RPCArg::Type::BOOL, RPCArg::Default{false}, "Create a blank wallet. A blank wallet has no keys or HD seed. One can be set using sethdseed."},
2699-
{"passphrase", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "Encrypt the wallet with this passphrase."},
2699+
{"passphrase", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "Encrypt the wallet with this passphrase."},
27002700
{"avoid_reuse", RPCArg::Type::BOOL, RPCArg::Default{false}, "Keep track of coin reuse, and treat dirty and clean coins differently with privacy considerations in mind."},
27012701
{"descriptors", RPCArg::Type::BOOL, RPCArg::Default{false}, "Create a native descriptor wallet. The wallet will use descriptors internally to handle address creation"},
2702-
{"load_on_startup", RPCArg::Type::BOOL, RPCArg::Default{UniValue::VNULL}, "Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged."},
2702+
{"load_on_startup", RPCArg::Type::BOOL, RPCArg::Optional::OMITTED_NAMED_ARG, "Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged."},
27032703
{"external_signer", RPCArg::Type::BOOL, RPCArg::Default{false}, "Use an external signer such as a hardware wallet. Requires -signer to be configured. Wallet creation will fail if keys cannot be fetched. Requires disable_private_keys and descriptors set to true."},
27042704
},
27052705
RPCResult{
@@ -2790,7 +2790,7 @@ static RPCHelpMan unloadwallet()
27902790
"Specifying the wallet name on a wallet endpoint is invalid.",
27912791
{
27922792
{"wallet_name", RPCArg::Type::STR, RPCArg::DefaultHint{"the wallet name from the RPC endpoint"}, "The name of the wallet to unload. If provided both here and in the RPC endpoint, the two must be identical."},
2793-
{"load_on_startup", RPCArg::Type::BOOL, RPCArg::Default{UniValue::VNULL}, "Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged."},
2793+
{"load_on_startup", RPCArg::Type::BOOL, RPCArg::Optional::OMITTED_NAMED_ARG, "Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged."},
27942794
},
27952795
RPCResult{RPCResult::Type::OBJ, "", "", {
27962796
{RPCResult::Type::STR, "warning", "Warning message if wallet was not unloaded cleanly."},
@@ -4021,7 +4021,7 @@ static RPCHelpMan send()
40214021
"That is, each address can only appear once and there can only be one 'data' object.\n"
40224022
"For convenience, a dictionary, which holds the key-value pairs directly, is also accepted.",
40234023
{
4024-
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
4024+
{"", RPCArg::Type::OBJ_USER_KEYS, RPCArg::Optional::OMITTED, "",
40254025
{
40264026
{"address", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in " + CURRENCY_UNIT + ""},
40274027
},
@@ -4370,7 +4370,7 @@ static RPCHelpMan walletcreatefundedpsbt()
43704370
"For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n"
43714371
"accepted as second parameter.",
43724372
{
4373-
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
4373+
{"", RPCArg::Type::OBJ_USER_KEYS, RPCArg::Optional::OMITTED, "",
43744374
{
43754375
{"address", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in " + CURRENCY_UNIT + ""},
43764376
},

0 commit comments

Comments
 (0)