aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/blockchain.cpp
diff options
context:
space:
mode:
authorW. J. van der Laan <laanwj@protonmail.com>2021-12-07 12:21:43 +0100
committerW. J. van der Laan <laanwj@protonmail.com>2021-12-07 12:38:23 +0100
commit6ac8c4f7001b30fa49e66f64b513d58eb83e621d (patch)
tree4dece41e66dbb7e3d4ebf6cd1c6f84a793e999bd /src/rpc/blockchain.cpp
parentabc26fa37881bf41021d32719384673de4ee3963 (diff)
parent1ed5681407adc1acc60c9bfebde5819f077f0bf3 (diff)
downloadbitcoin-6ac8c4f7001b30fa49e66f64b513d58eb83e621d.tar.xz
Merge bitcoin/bitcoin#23634: rpc: add missing scantxoutset examples
1ed5681407adc1acc60c9bfebde5819f077f0bf3 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 https://github.com/bitcoin/bitcoin/pull/16285#issuecomment-529313781). ~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 1ed5681407adc1acc60c9bfebde5819f077f0bf3 Tree-SHA512: 057ad9ac0d019035bee2332440128de0ef08580bbeae80182ff74771beead3555c4bf7008071a97bbb6a8d85fb85d0f0754fb7941db2c5b755eae1ac9aa65318
Diffstat (limited to 'src/rpc/blockchain.cpp')
-rw-r--r--src/rpc/blockchain.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index bd11d76866..f3abe97fc9 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -2298,6 +2298,9 @@ public:
static RPCHelpMan scantxoutset()
{
+ // scriptPubKey corresponding to mainnet address 12cbQLTFMXRnSzktFkuoG3eHoMeFtpTu3S
+ const std::string EXAMPLE_DESCRIPTOR_RAW = "raw(76a91411b366edfc0a8b66feebae5c2e25a7b6a5d1cf3188ac)#fm24fxxy";
+
return RPCHelpMan{"scantxoutset",
"\nScans the unspent transaction output set for entries that match certain output descriptors.\n"
"Examples of output descriptors are:\n"
@@ -2355,7 +2358,14 @@ static RPCHelpMan scantxoutset()
{RPCResult::Type::STR_AMOUNT, "total_amount", "The total amount of all found unspent outputs in " + CURRENCY_UNIT},
}},
},
- RPCExamples{""},
+ RPCExamples{
+ HelpExampleCli("scantxoutset", "start \'[\"" + EXAMPLE_DESCRIPTOR_RAW + "\"]\'") +
+ HelpExampleCli("scantxoutset", "status") +
+ HelpExampleCli("scantxoutset", "abort") +
+ HelpExampleRpc("scantxoutset", "\"start\", [\"" + EXAMPLE_DESCRIPTOR_RAW + "\"]") +
+ HelpExampleRpc("scantxoutset", "\"status\"") +
+ HelpExampleRpc("scantxoutset", "\"abort\"")
+ },
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VARR});