Skip to content

Commit 6ac8c4f

Browse files
committed
Merge bitcoin/bitcoin#23634: rpc: add missing scantxoutset examples
1ed5681 rpc: add missing scantxoutset examples (Sebastian Falbesoner) Pull request description: The scantxoutset RPC and its help text was at last improved in #16285, but it's still missing examples (see bitcoin/bitcoin#16285 (comment)). ~Note that the example descriptor used doesn't follow the developer guideline of using invalid bech32 addresses, as the RPC is not wallet-related and it's use-case is merely to look up state information (i.e. there is no danger of sending funds to a wrong address).~ For the sake of simplicity, the raw descriptor for an early coinbase payout address (block 9) is taken, i.e. it yields results even at an early stage of IBD. Happy to change that though if there are other suggestions. ACKs for top commit: shaavan: reACK 1ed5681 Tree-SHA512: 057ad9ac0d019035bee2332440128de0ef08580bbeae80182ff74771beead3555c4bf7008071a97bbb6a8d85fb85d0f0754fb7941db2c5b755eae1ac9aa65318
2 parents abc26fa + 1ed5681 commit 6ac8c4f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/rpc/blockchain.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2298,6 +2298,9 @@ class CoinsViewScanReserver
22982298

22992299
static RPCHelpMan scantxoutset()
23002300
{
2301+
// scriptPubKey corresponding to mainnet address 12cbQLTFMXRnSzktFkuoG3eHoMeFtpTu3S
2302+
const std::string EXAMPLE_DESCRIPTOR_RAW = "raw(76a91411b366edfc0a8b66feebae5c2e25a7b6a5d1cf3188ac)#fm24fxxy";
2303+
23012304
return RPCHelpMan{"scantxoutset",
23022305
"\nScans the unspent transaction output set for entries that match certain output descriptors.\n"
23032306
"Examples of output descriptors are:\n"
@@ -2355,7 +2358,14 @@ static RPCHelpMan scantxoutset()
23552358
{RPCResult::Type::STR_AMOUNT, "total_amount", "The total amount of all found unspent outputs in " + CURRENCY_UNIT},
23562359
}},
23572360
},
2358-
RPCExamples{""},
2361+
RPCExamples{
2362+
HelpExampleCli("scantxoutset", "start \'[\"" + EXAMPLE_DESCRIPTOR_RAW + "\"]\'") +
2363+
HelpExampleCli("scantxoutset", "status") +
2364+
HelpExampleCli("scantxoutset", "abort") +
2365+
HelpExampleRpc("scantxoutset", "\"start\", [\"" + EXAMPLE_DESCRIPTOR_RAW + "\"]") +
2366+
HelpExampleRpc("scantxoutset", "\"status\"") +
2367+
HelpExampleRpc("scantxoutset", "\"abort\"")
2368+
},
23592369
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
23602370
{
23612371
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VARR});

0 commit comments

Comments
 (0)