Skip to content

Commit fabaccf

Browse files
author
MarcoFalke
committed
rpc: Properly document scantxoutset return value
Can be reviewed with --ignore-all-space
1 parent faa2059 commit fabaccf

File tree

1 file changed

+54
-49
lines changed

1 file changed

+54
-49
lines changed

src/rpc/blockchain.cpp

Lines changed: 54 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,59 +2136,64 @@ class CoinsViewScanReserver
21362136
static RPCHelpMan scantxoutset()
21372137
{
21382138
return RPCHelpMan{"scantxoutset",
2139-
"\nEXPERIMENTAL warning: this call may be removed or changed in future releases.\n"
2140-
"\nScans the unspent transaction output set for entries that match certain output descriptors.\n"
2141-
"Examples of output descriptors are:\n"
2142-
" addr(<address>) Outputs whose scriptPubKey corresponds to the specified address (does not include P2PK)\n"
2143-
" raw(<hex script>) Outputs whose scriptPubKey equals the specified hex scripts\n"
2144-
" combo(<pubkey>) P2PK, P2PKH, P2WPKH, and P2SH-P2WPKH outputs for the given pubkey\n"
2145-
" pkh(<pubkey>) P2PKH outputs for the given pubkey\n"
2146-
" sh(multi(<n>,<pubkey>,<pubkey>,...)) P2SH-multisig outputs for the given threshold and pubkeys\n"
2147-
"\nIn the above, <pubkey> either refers to a fixed public key in hexadecimal notation, or to an xpub/xprv optionally followed by one\n"
2148-
"or more path elements separated by \"/\", and optionally ending in \"/*\" (unhardened), or \"/*'\" or \"/*h\" (hardened) to specify all\n"
2149-
"unhardened or hardened child keys.\n"
2150-
"In the latter case, a range needs to be specified by below if different from 1000.\n"
2151-
"For more information on output descriptors, see the documentation in the doc/descriptors.md file.\n",
2139+
"\nEXPERIMENTAL warning: this call may be removed or changed in future releases.\n"
2140+
"\nScans the unspent transaction output set for entries that match certain output descriptors.\n"
2141+
"Examples of output descriptors are:\n"
2142+
" addr(<address>) Outputs whose scriptPubKey corresponds to the specified address (does not include P2PK)\n"
2143+
" raw(<hex script>) Outputs whose scriptPubKey equals the specified hex scripts\n"
2144+
" combo(<pubkey>) P2PK, P2PKH, P2WPKH, and P2SH-P2WPKH outputs for the given pubkey\n"
2145+
" pkh(<pubkey>) P2PKH outputs for the given pubkey\n"
2146+
" sh(multi(<n>,<pubkey>,<pubkey>,...)) P2SH-multisig outputs for the given threshold and pubkeys\n"
2147+
"\nIn the above, <pubkey> either refers to a fixed public key in hexadecimal notation, or to an xpub/xprv optionally followed by one\n"
2148+
"or more path elements separated by \"/\", and optionally ending in \"/*\" (unhardened), or \"/*'\" or \"/*h\" (hardened) to specify all\n"
2149+
"unhardened or hardened child keys.\n"
2150+
"In the latter case, a range needs to be specified by below if different from 1000.\n"
2151+
"For more information on output descriptors, see the documentation in the doc/descriptors.md file.\n",
2152+
{
2153+
{"action", RPCArg::Type::STR, RPCArg::Optional::NO, "The action to execute\n"
2154+
"\"start\" for starting a scan\n"
2155+
"\"abort\" for aborting the current scan (returns true when abort was successful)\n"
2156+
"\"status\" for progress report (in %) of the current scan"},
2157+
{"scanobjects", RPCArg::Type::ARR, RPCArg::Optional::OMITTED, "Array of scan objects. Required for \"start\" action\n"
2158+
"Every scan object is either a string descriptor or an object:",
2159+
{
2160+
{"descriptor", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "An output descriptor"},
2161+
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "An object with output descriptor and metadata",
21522162
{
2153-
{"action", RPCArg::Type::STR, RPCArg::Optional::NO, "The action to execute\n"
2154-
" \"start\" for starting a scan\n"
2155-
" \"abort\" for aborting the current scan (returns true when abort was successful)\n"
2156-
" \"status\" for progress report (in %) of the current scan"},
2157-
{"scanobjects", RPCArg::Type::ARR, RPCArg::Optional::OMITTED, "Array of scan objects. Required for \"start\" action\n"
2158-
" Every scan object is either a string descriptor or an object:",
2159-
{
2160-
{"descriptor", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "An output descriptor"},
2161-
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "An object with output descriptor and metadata",
2162-
{
2163-
{"desc", RPCArg::Type::STR, RPCArg::Optional::NO, "An output descriptor"},
2164-
{"range", RPCArg::Type::RANGE, /* default */ "1000", "The range of HD chain indexes to explore (either end or [begin,end])"},
2165-
},
2166-
},
2167-
},
2163+
{"desc", RPCArg::Type::STR, RPCArg::Optional::NO, "An output descriptor"},
2164+
{"range", RPCArg::Type::RANGE, /* default */ "1000", "The range of HD chain indexes to explore (either end or [begin,end])"},
2165+
}},
2166+
},
21682167
"[scanobjects,...]"},
2169-
},
2170-
RPCResult{
2171-
RPCResult::Type::OBJ, "", "",
2168+
},
2169+
{
2170+
RPCResult{"When action=='abort'", RPCResult::Type::BOOL, "", ""},
2171+
RPCResult{"When action=='status' and no scan is in progress", RPCResult::Type::NONE, "", ""},
2172+
RPCResult{"When action=='status' and scan is in progress", RPCResult::Type::OBJ, "", "",
2173+
{
2174+
{RPCResult::Type::NUM, "progress", "The scan progress"},
2175+
}},
2176+
RPCResult{"When action=='start'", RPCResult::Type::OBJ, "", "", {
2177+
{RPCResult::Type::BOOL, "success", "Whether the scan was completed"},
2178+
{RPCResult::Type::NUM, "txouts", "The number of unspent transaction outputs scanned"},
2179+
{RPCResult::Type::NUM, "height", "The current block height (index)"},
2180+
{RPCResult::Type::STR_HEX, "bestblock", "The hash of the block at the tip of the chain"},
2181+
{RPCResult::Type::ARR, "unspents", "",
2182+
{
2183+
{RPCResult::Type::OBJ, "", "",
21722184
{
2173-
{RPCResult::Type::BOOL, "success", "Whether the scan was completed"},
2174-
{RPCResult::Type::NUM, "txouts", "The number of unspent transaction outputs scanned"},
2175-
{RPCResult::Type::NUM, "height", "The current block height (index)"},
2176-
{RPCResult::Type::STR_HEX, "bestblock", "The hash of the block at the tip of the chain"},
2177-
{RPCResult::Type::ARR, "unspents", "",
2178-
{
2179-
{RPCResult::Type::OBJ, "", "",
2180-
{
2181-
{RPCResult::Type::STR_HEX, "txid", "The transaction id"},
2182-
{RPCResult::Type::NUM, "vout", "The vout value"},
2183-
{RPCResult::Type::STR_HEX, "scriptPubKey", "The script key"},
2184-
{RPCResult::Type::STR, "desc", "A specialized descriptor for the matched scriptPubKey"},
2185-
{RPCResult::Type::STR_AMOUNT, "amount", "The total amount in " + CURRENCY_UNIT + " of the unspent output"},
2186-
{RPCResult::Type::NUM, "height", "Height of the unspent transaction output"},
2187-
}},
2188-
}},
2189-
{RPCResult::Type::STR_AMOUNT, "total_amount", "The total amount of all found unspent outputs in " + CURRENCY_UNIT},
2185+
{RPCResult::Type::STR_HEX, "txid", "The transaction id"},
2186+
{RPCResult::Type::NUM, "vout", "The vout value"},
2187+
{RPCResult::Type::STR_HEX, "scriptPubKey", "The script key"},
2188+
{RPCResult::Type::STR, "desc", "A specialized descriptor for the matched scriptPubKey"},
2189+
{RPCResult::Type::STR_AMOUNT, "amount", "The total amount in " + CURRENCY_UNIT + " of the unspent output"},
2190+
{RPCResult::Type::NUM, "height", "Height of the unspent transaction output"},
21902191
}},
2191-
RPCExamples{""},
2192+
}},
2193+
{RPCResult::Type::STR_AMOUNT, "total_amount", "The total amount of all found unspent outputs in " + CURRENCY_UNIT},
2194+
}},
2195+
},
2196+
RPCExamples{""},
21922197
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
21932198
{
21942199
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VARR});

0 commit comments

Comments
 (0)