rpc: Document an RPCResult for all calls; Enforce at compile time

This commit is contained in:
MarcoFalke 2020-03-13 14:40:53 -04:00
parent fadd99f610
commit fac52253f8
No known key found for this signature in database
GPG key ID: CE2B75697E69A548
8 changed files with 46 additions and 41 deletions

View file

@ -345,7 +345,7 @@ static UniValue syncwithvalidationinterfacequeue(const JSONRPCRequest& request)
RPCHelpMan{"syncwithvalidationinterfacequeue", RPCHelpMan{"syncwithvalidationinterfacequeue",
"\nWaits for the validation interface queue to catch up on everything that was there when we entered this function.\n", "\nWaits for the validation interface queue to catch up on everything that was there when we entered this function.\n",
{}, {},
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
HelpExampleCli("syncwithvalidationinterfacequeue","") HelpExampleCli("syncwithvalidationinterfacequeue","")
+ HelpExampleRpc("syncwithvalidationinterfacequeue","") + HelpExampleRpc("syncwithvalidationinterfacequeue","")
@ -1435,7 +1435,7 @@ static UniValue preciousblock(const JSONRPCRequest& request)
{ {
{"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "the hash of the block to mark as precious"}, {"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "the hash of the block to mark as precious"},
}, },
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
HelpExampleCli("preciousblock", "\"blockhash\"") HelpExampleCli("preciousblock", "\"blockhash\"")
+ HelpExampleRpc("preciousblock", "\"blockhash\"") + HelpExampleRpc("preciousblock", "\"blockhash\"")
@ -1470,7 +1470,7 @@ static UniValue invalidateblock(const JSONRPCRequest& request)
{ {
{"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "the hash of the block to mark as invalid"}, {"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "the hash of the block to mark as invalid"},
}, },
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
HelpExampleCli("invalidateblock", "\"blockhash\"") HelpExampleCli("invalidateblock", "\"blockhash\"")
+ HelpExampleRpc("invalidateblock", "\"blockhash\"") + HelpExampleRpc("invalidateblock", "\"blockhash\"")
@ -1509,7 +1509,7 @@ static UniValue reconsiderblock(const JSONRPCRequest& request)
{ {
{"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "the hash of the block to reconsider"}, {"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "the hash of the block to reconsider"},
}, },
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
HelpExampleCli("reconsiderblock", "\"blockhash\"") HelpExampleCli("reconsiderblock", "\"blockhash\"")
+ HelpExampleRpc("reconsiderblock", "\"blockhash\"") + HelpExampleRpc("reconsiderblock", "\"blockhash\"")
@ -1933,7 +1933,7 @@ static UniValue savemempool(const JSONRPCRequest& request)
RPCHelpMan{"savemempool", RPCHelpMan{"savemempool",
"\nDumps the mempool to disk. It will fail until the previous dump is fully loaded.\n", "\nDumps the mempool to disk. It will fail until the previous dump is fully loaded.\n",
{}, {},
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
HelpExampleCli("savemempool", "") HelpExampleCli("savemempool", "")
+ HelpExampleRpc("savemempool", "") + HelpExampleRpc("savemempool", "")

View file

@ -751,7 +751,7 @@ static UniValue submitblock(const JSONRPCRequest& request)
{"hexdata", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "the hex-encoded block data to submit"}, {"hexdata", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "the hex-encoded block data to submit"},
{"dummy", RPCArg::Type::STR, /* default */ "ignored", "dummy value, for compatibility with BIP22. This value is ignored."}, {"dummy", RPCArg::Type::STR, /* default */ "ignored", "dummy value, for compatibility with BIP22. This value is ignored."},
}, },
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", "Returns JSON Null when valid, a string according to BIP22 otherwise"},
RPCExamples{ RPCExamples{
HelpExampleCli("submitblock", "\"mydata\"") HelpExampleCli("submitblock", "\"mydata\"")
+ HelpExampleRpc("submitblock", "\"mydata\"") + HelpExampleRpc("submitblock", "\"mydata\"")

View file

@ -347,7 +347,7 @@ static UniValue setmocktime(const JSONRPCRequest& request)
{"timestamp", RPCArg::Type::NUM, RPCArg::Optional::NO, UNIX_EPOCH_TIME + "\n" {"timestamp", RPCArg::Type::NUM, RPCArg::Optional::NO, UNIX_EPOCH_TIME + "\n"
" Pass 0 to go back to using the system time."}, " Pass 0 to go back to using the system time."},
}, },
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{""}, RPCExamples{""},
}.Check(request); }.Check(request);
@ -375,7 +375,7 @@ static UniValue mockscheduler(const JSONRPCRequest& request)
{ {
{"delta_time", RPCArg::Type::NUM, RPCArg::Optional::NO, "Number of seconds to forward the scheduler into the future." }, {"delta_time", RPCArg::Type::NUM, RPCArg::Optional::NO, "Number of seconds to forward the scheduler into the future." },
}, },
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{""}, RPCExamples{""},
}.Check(request); }.Check(request);
@ -579,7 +579,7 @@ static UniValue echo(const JSONRPCRequest& request)
"\nThe difference between echo and echojson is that echojson has argument conversion enabled in the client-side table in " "\nThe difference between echo and echojson is that echojson has argument conversion enabled in the client-side table in "
"bitcoin-cli and the GUI. There is no server-side difference.", "bitcoin-cli and the GUI. There is no server-side difference.",
{}, {},
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", "Returns whatever was passed in"},
RPCExamples{""}, RPCExamples{""},
}.ToString() }.ToString()
); );

View file

@ -54,7 +54,7 @@ static UniValue ping(const JSONRPCRequest& request)
"Results provided in getpeerinfo, pingtime and pingwait fields are decimal seconds.\n" "Results provided in getpeerinfo, pingtime and pingwait fields are decimal seconds.\n"
"Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping.\n", "Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping.\n",
{}, {},
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
HelpExampleCli("ping", "") HelpExampleCli("ping", "")
+ HelpExampleRpc("ping", "") + HelpExampleRpc("ping", "")
@ -240,7 +240,7 @@ static UniValue addnode(const JSONRPCRequest& request)
{"node", RPCArg::Type::STR, RPCArg::Optional::NO, "The node (see getpeerinfo for nodes)"}, {"node", RPCArg::Type::STR, RPCArg::Optional::NO, "The node (see getpeerinfo for nodes)"},
{"command", RPCArg::Type::STR, RPCArg::Optional::NO, "'add' to add a node to the list, 'remove' to remove a node from the list, 'onetry' to try a connection to the node once"}, {"command", RPCArg::Type::STR, RPCArg::Optional::NO, "'add' to add a node to the list, 'remove' to remove a node from the list, 'onetry' to try a connection to the node once"},
}, },
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
HelpExampleCli("addnode", "\"192.168.0.6:8333\" \"onetry\"") HelpExampleCli("addnode", "\"192.168.0.6:8333\" \"onetry\"")
+ HelpExampleRpc("addnode", "\"192.168.0.6:8333\", \"onetry\"") + HelpExampleRpc("addnode", "\"192.168.0.6:8333\", \"onetry\"")
@ -283,7 +283,7 @@ static UniValue disconnectnode(const JSONRPCRequest& request)
{"address", RPCArg::Type::STR, /* default */ "fallback to nodeid", "The IP address/port of the node"}, {"address", RPCArg::Type::STR, /* default */ "fallback to nodeid", "The IP address/port of the node"},
{"nodeid", RPCArg::Type::NUM, /* default */ "fallback to address", "The node ID (see getpeerinfo for node IDs)"}, {"nodeid", RPCArg::Type::NUM, /* default */ "fallback to address", "The node ID (see getpeerinfo for node IDs)"},
}, },
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
HelpExampleCli("disconnectnode", "\"192.168.0.6:8333\"") HelpExampleCli("disconnectnode", "\"192.168.0.6:8333\"")
+ HelpExampleCli("disconnectnode", "\"\" 1") + HelpExampleCli("disconnectnode", "\"\" 1")
@ -553,7 +553,7 @@ static UniValue setban(const JSONRPCRequest& request)
{"bantime", RPCArg::Type::NUM, /* default */ "0", "time in seconds how long (or until when if [absolute] is set) the IP is banned (0 or empty means using the default time of 24h which can also be overwritten by the -bantime startup argument)"}, {"bantime", RPCArg::Type::NUM, /* default */ "0", "time in seconds how long (or until when if [absolute] is set) the IP is banned (0 or empty means using the default time of 24h which can also be overwritten by the -bantime startup argument)"},
{"absolute", RPCArg::Type::BOOL, /* default */ "false", "If set, the bantime must be an absolute timestamp expressed in " + UNIX_EPOCH_TIME}, {"absolute", RPCArg::Type::BOOL, /* default */ "false", "If set, the bantime must be an absolute timestamp expressed in " + UNIX_EPOCH_TIME},
}, },
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
HelpExampleCli("setban", "\"192.168.0.6\" \"add\" 86400") HelpExampleCli("setban", "\"192.168.0.6\" \"add\" 86400")
+ HelpExampleCli("setban", "\"192.168.0.0/24\" \"add\"") + HelpExampleCli("setban", "\"192.168.0.0/24\" \"add\"")
@ -628,7 +628,16 @@ static UniValue listbanned(const JSONRPCRequest& request)
RPCHelpMan{"listbanned", RPCHelpMan{"listbanned",
"\nList all banned IPs/Subnets.\n", "\nList all banned IPs/Subnets.\n",
{}, {},
RPCResults{}, RPCResult{RPCResult::Type::ARR, "", "",
{
{RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::STR, "address", ""},
{RPCResult::Type::NUM_TIME, "banned_until", ""},
{RPCResult::Type::NUM_TIME, "ban_created", ""},
{RPCResult::Type::STR, "ban_reason", ""},
}},
}},
RPCExamples{ RPCExamples{
HelpExampleCli("listbanned", "") HelpExampleCli("listbanned", "")
+ HelpExampleRpc("listbanned", "") + HelpExampleRpc("listbanned", "")
@ -663,7 +672,7 @@ static UniValue clearbanned(const JSONRPCRequest& request)
RPCHelpMan{"clearbanned", RPCHelpMan{"clearbanned",
"\nClear all banned IPs.\n", "\nClear all banned IPs.\n",
{}, {},
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
HelpExampleCli("clearbanned", "") HelpExampleCli("clearbanned", "")
+ HelpExampleRpc("clearbanned", "") + HelpExampleRpc("clearbanned", "")
@ -685,7 +694,7 @@ static UniValue setnetworkactive(const JSONRPCRequest& request)
{ {
{"state", RPCArg::Type::BOOL, RPCArg::Optional::NO, "true to enable networking, false to disable"}, {"state", RPCArg::Type::BOOL, RPCArg::Optional::NO, "true to enable networking, false to disable"},
}, },
RPCResults{}, RPCResult{RPCResult::Type::BOOL, "", "The value that was passed in"},
RPCExamples{""}, RPCExamples{""},
}.Check(request); }.Check(request);

View file

@ -153,6 +153,7 @@ UniValue help(const JSONRPCRequest& jsonRequest)
UniValue stop(const JSONRPCRequest& jsonRequest) UniValue stop(const JSONRPCRequest& jsonRequest)
{ {
static const std::string RESULT{PACKAGE_NAME " stopping"};
// Accept the deprecated and ignored 'detach' boolean argument // Accept the deprecated and ignored 'detach' boolean argument
// Also accept the hidden 'wait' integer argument (milliseconds) // Also accept the hidden 'wait' integer argument (milliseconds)
// For instance, 'stop 1000' makes the call wait 1 second before returning // For instance, 'stop 1000' makes the call wait 1 second before returning
@ -162,7 +163,7 @@ UniValue stop(const JSONRPCRequest& jsonRequest)
RPCHelpMan{"stop", RPCHelpMan{"stop",
"\nRequest a graceful shutdown of " PACKAGE_NAME ".", "\nRequest a graceful shutdown of " PACKAGE_NAME ".",
{}, {},
RPCResults{}, RPCResult{RPCResult::Type::STR, "", "A string with the content '" + RESULT + "'"},
RPCExamples{""}, RPCExamples{""},
}.ToString()); }.ToString());
// Event loop will exit after current HTTP requests have been handled, so // Event loop will exit after current HTTP requests have been handled, so
@ -171,7 +172,7 @@ UniValue stop(const JSONRPCRequest& jsonRequest)
if (jsonRequest.params[0].isNum()) { if (jsonRequest.params[0].isNum()) {
UninterruptibleSleep(std::chrono::milliseconds{jsonRequest.params[0].get_int()}); UninterruptibleSleep(std::chrono::milliseconds{jsonRequest.params[0].get_int()});
} }
return PACKAGE_NAME " stopping"; return RESULT;
} }
static UniValue uptime(const JSONRPCRequest& jsonRequest) static UniValue uptime(const JSONRPCRequest& jsonRequest)

View file

@ -290,11 +290,6 @@ struct RPCResult {
struct RPCResults { struct RPCResults {
const std::vector<RPCResult> m_results; const std::vector<RPCResult> m_results;
RPCResults()
: m_results{}
{
}
RPCResults(RPCResult result) RPCResults(RPCResult result)
: m_results{{result}} : m_results{{result}}
{ {

View file

@ -106,7 +106,7 @@ UniValue importprivkey(const JSONRPCRequest& request)
{"label", RPCArg::Type::STR, /* default */ "current label if address exists, otherwise \"\"", "An optional label"}, {"label", RPCArg::Type::STR, /* default */ "current label if address exists, otherwise \"\"", "An optional label"},
{"rescan", RPCArg::Type::BOOL, /* default */ "true", "Rescan the wallet for transactions"}, {"rescan", RPCArg::Type::BOOL, /* default */ "true", "Rescan the wallet for transactions"},
}, },
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
"\nDump a private key\n" "\nDump a private key\n"
+ HelpExampleCli("dumpprivkey", "\"myaddress\"") + + HelpExampleCli("dumpprivkey", "\"myaddress\"") +
@ -203,7 +203,7 @@ UniValue abortrescan(const JSONRPCRequest& request)
"\nStops current wallet rescan triggered by an RPC call, e.g. by an importprivkey call.\n" "\nStops current wallet rescan triggered by an RPC call, e.g. by an importprivkey call.\n"
"Note: Use \"getwalletinfo\" to query the scanning progress.\n", "Note: Use \"getwalletinfo\" to query the scanning progress.\n",
{}, {},
RPCResults{}, RPCResult{RPCResult::Type::BOOL, "", "Whether the abort was successful"},
RPCExamples{ RPCExamples{
"\nImport a private key\n" "\nImport a private key\n"
+ HelpExampleCli("importprivkey", "\"mykey\"") + + HelpExampleCli("importprivkey", "\"mykey\"") +
@ -242,7 +242,7 @@ UniValue importaddress(const JSONRPCRequest& request)
{"rescan", RPCArg::Type::BOOL, /* default */ "true", "Rescan the wallet for transactions"}, {"rescan", RPCArg::Type::BOOL, /* default */ "true", "Rescan the wallet for transactions"},
{"p2sh", RPCArg::Type::BOOL, /* default */ "false", "Add the P2SH version of the script as well"}, {"p2sh", RPCArg::Type::BOOL, /* default */ "false", "Add the P2SH version of the script as well"},
}, },
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
"\nImport an address with rescan\n" "\nImport an address with rescan\n"
+ HelpExampleCli("importaddress", "\"myaddress\"") + + HelpExampleCli("importaddress", "\"myaddress\"") +
@ -337,7 +337,7 @@ UniValue importprunedfunds(const JSONRPCRequest& request)
{"rawtransaction", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A raw transaction in hex funding an already-existing address in wallet"}, {"rawtransaction", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A raw transaction in hex funding an already-existing address in wallet"},
{"txoutproof", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex output from gettxoutproof that contains the transaction"}, {"txoutproof", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex output from gettxoutproof that contains the transaction"},
}, },
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{""}, RPCExamples{""},
}.Check(request); }.Check(request);
@ -397,7 +397,7 @@ UniValue removeprunedfunds(const JSONRPCRequest& request)
{ {
{"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex-encoded id of the transaction you are deleting"}, {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex-encoded id of the transaction you are deleting"},
}, },
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
HelpExampleCli("removeprunedfunds", "\"a8d0c0184dde994a09ec054286f1ce581bebf46446a512166eae7628734ea0a5\"") + HelpExampleCli("removeprunedfunds", "\"a8d0c0184dde994a09ec054286f1ce581bebf46446a512166eae7628734ea0a5\"") +
"\nAs a JSON-RPC call\n" "\nAs a JSON-RPC call\n"
@ -443,7 +443,7 @@ UniValue importpubkey(const JSONRPCRequest& request)
{"label", RPCArg::Type::STR, /* default */ "\"\"", "An optional label"}, {"label", RPCArg::Type::STR, /* default */ "\"\"", "An optional label"},
{"rescan", RPCArg::Type::BOOL, /* default */ "true", "Rescan the wallet for transactions"}, {"rescan", RPCArg::Type::BOOL, /* default */ "true", "Rescan the wallet for transactions"},
}, },
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
"\nImport a public key with rescan\n" "\nImport a public key with rescan\n"
+ HelpExampleCli("importpubkey", "\"mypubkey\"") + + HelpExampleCli("importpubkey", "\"mypubkey\"") +
@ -527,7 +527,7 @@ UniValue importwallet(const JSONRPCRequest& request)
{ {
{"filename", RPCArg::Type::STR, RPCArg::Optional::NO, "The wallet file"}, {"filename", RPCArg::Type::STR, RPCArg::Optional::NO, "The wallet file"},
}, },
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
"\nDump the wallet\n" "\nDump the wallet\n"
+ HelpExampleCli("dumpwallet", "\"test\"") + + HelpExampleCli("dumpwallet", "\"test\"") +

View file

@ -301,7 +301,7 @@ static UniValue setlabel(const JSONRPCRequest& request)
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The bitcoin address to be associated with a label."}, {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The bitcoin address to be associated with a label."},
{"label", RPCArg::Type::STR, RPCArg::Optional::NO, "The label to assign to the address."}, {"label", RPCArg::Type::STR, RPCArg::Optional::NO, "The label to assign to the address."},
}, },
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
HelpExampleCli("setlabel", "\"" + EXAMPLE_ADDRESS[0] + "\" \"tabby\"") HelpExampleCli("setlabel", "\"" + EXAMPLE_ADDRESS[0] + "\" \"tabby\"")
+ HelpExampleRpc("setlabel", "\"" + EXAMPLE_ADDRESS[0] + "\", \"tabby\"") + HelpExampleRpc("setlabel", "\"" + EXAMPLE_ADDRESS[0] + "\", \"tabby\"")
@ -784,7 +784,7 @@ static UniValue getunconfirmedbalance(const JSONRPCRequest &request)
RPCHelpMan{"getunconfirmedbalance", RPCHelpMan{"getunconfirmedbalance",
"DEPRECATED\nIdentical to getbalances().mine.untrusted_pending\n", "DEPRECATED\nIdentical to getbalances().mine.untrusted_pending\n",
{}, {},
RPCResults{}, RPCResult{RPCResult::Type::NUM, "", "The balance"},
RPCExamples{""}, RPCExamples{""},
}.Check(request); }.Check(request);
@ -1776,7 +1776,7 @@ static UniValue abandontransaction(const JSONRPCRequest& request)
{ {
{"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"}, {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
}, },
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
HelpExampleCli("abandontransaction", "\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"") HelpExampleCli("abandontransaction", "\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"")
+ HelpExampleRpc("abandontransaction", "\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"") + HelpExampleRpc("abandontransaction", "\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"")
@ -1817,7 +1817,7 @@ static UniValue backupwallet(const JSONRPCRequest& request)
{ {
{"destination", RPCArg::Type::STR, RPCArg::Optional::NO, "The destination directory or file"}, {"destination", RPCArg::Type::STR, RPCArg::Optional::NO, "The destination directory or file"},
}, },
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
HelpExampleCli("backupwallet", "\"backup.dat\"") HelpExampleCli("backupwallet", "\"backup.dat\"")
+ HelpExampleRpc("backupwallet", "\"backup.dat\"") + HelpExampleRpc("backupwallet", "\"backup.dat\"")
@ -1855,7 +1855,7 @@ static UniValue keypoolrefill(const JSONRPCRequest& request)
{ {
{"newsize", RPCArg::Type::NUM, /* default */ "100", "The new keypool size"}, {"newsize", RPCArg::Type::NUM, /* default */ "100", "The new keypool size"},
}, },
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
HelpExampleCli("keypoolrefill", "") HelpExampleCli("keypoolrefill", "")
+ HelpExampleRpc("keypoolrefill", "") + HelpExampleRpc("keypoolrefill", "")
@ -1907,7 +1907,7 @@ static UniValue walletpassphrase(const JSONRPCRequest& request)
{"passphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The wallet passphrase"}, {"passphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The wallet passphrase"},
{"timeout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The time to keep the decryption key in seconds; capped at 100000000 (~3 years)."}, {"timeout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The time to keep the decryption key in seconds; capped at 100000000 (~3 years)."},
}, },
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
"\nUnlock the wallet for 60 seconds\n" "\nUnlock the wallet for 60 seconds\n"
+ HelpExampleCli("walletpassphrase", "\"my pass phrase\" 60") + + HelpExampleCli("walletpassphrase", "\"my pass phrase\" 60") +
@ -1987,7 +1987,7 @@ static UniValue walletpassphrasechange(const JSONRPCRequest& request)
{"oldpassphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The current passphrase"}, {"oldpassphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The current passphrase"},
{"newpassphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The new passphrase"}, {"newpassphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The new passphrase"},
}, },
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
HelpExampleCli("walletpassphrasechange", "\"old one\" \"new one\"") HelpExampleCli("walletpassphrasechange", "\"old one\" \"new one\"")
+ HelpExampleRpc("walletpassphrasechange", "\"old one\", \"new one\"") + HelpExampleRpc("walletpassphrasechange", "\"old one\", \"new one\"")
@ -2037,7 +2037,7 @@ static UniValue walletlock(const JSONRPCRequest& request)
"After calling this method, you will need to call walletpassphrase again\n" "After calling this method, you will need to call walletpassphrase again\n"
"before being able to call any methods which require the wallet to be unlocked.\n", "before being able to call any methods which require the wallet to be unlocked.\n",
{}, {},
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
"\nSet the passphrase for 2 minutes to perform a transaction\n" "\nSet the passphrase for 2 minutes to perform a transaction\n"
+ HelpExampleCli("walletpassphrase", "\"my pass phrase\" 120") + + HelpExampleCli("walletpassphrase", "\"my pass phrase\" 120") +
@ -2082,7 +2082,7 @@ static UniValue encryptwallet(const JSONRPCRequest& request)
{ {
{"passphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long."}, {"passphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long."},
}, },
RPCResults{}, RPCResult{RPCResult::Type::STR, "", "A string with further instructions"},
RPCExamples{ RPCExamples{
"\nEncrypt your wallet\n" "\nEncrypt your wallet\n"
+ HelpExampleCli("encryptwallet", "\"my pass phrase\"") + + HelpExampleCli("encryptwallet", "\"my pass phrase\"") +
@ -2767,7 +2767,7 @@ static UniValue unloadwallet(const JSONRPCRequest& request)
{ {
{"wallet_name", RPCArg::Type::STR, /* default */ "the wallet name from the RPC request", "The name of the wallet to unload."}, {"wallet_name", RPCArg::Type::STR, /* default */ "the wallet name from the RPC request", "The name of the wallet to unload."},
}, },
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
HelpExampleCli("unloadwallet", "wallet_name") HelpExampleCli("unloadwallet", "wallet_name")
+ HelpExampleRpc("unloadwallet", "wallet_name") + HelpExampleRpc("unloadwallet", "wallet_name")
@ -4013,7 +4013,7 @@ UniValue sethdseed(const JSONRPCRequest& request)
{"seed", RPCArg::Type::STR, /* default */ "random seed", "The WIF private key to use as the new HD seed.\n" {"seed", RPCArg::Type::STR, /* default */ "random seed", "The WIF private key to use as the new HD seed.\n"
" The seed value can be retrieved using the dumpwallet command. It is the private key marked hdseed=1"}, " The seed value can be retrieved using the dumpwallet command. It is the private key marked hdseed=1"},
}, },
RPCResults{}, RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{ RPCExamples{
HelpExampleCli("sethdseed", "") HelpExampleCli("sethdseed", "")
+ HelpExampleCli("sethdseed", "false") + HelpExampleCli("sethdseed", "false")