@@ -2019,6 +2019,40 @@ class CoinsViewScanReserver
2019
2019
}
2020
2020
};
2021
2021
2022
+ static const auto scan_action_arg_desc = RPCArg{
2023
+ " action" , RPCArg::Type::STR, RPCArg::Optional::NO, " The action to execute\n "
2024
+ " \" start\" for starting a scan\n "
2025
+ " \" abort\" for aborting the current scan (returns true when abort was successful)\n "
2026
+ " \" status\" for progress report (in %) of the current scan"
2027
+ };
2028
+
2029
+ static const auto scan_objects_arg_desc = RPCArg{
2030
+ " scanobjects" , RPCArg::Type::ARR, RPCArg::Optional::OMITTED, " Array of scan objects. Required for \" start\" action\n "
2031
+ " Every scan object is either a string descriptor or an object:" ,
2032
+ {
2033
+ {" descriptor" , RPCArg::Type::STR, RPCArg::Optional::OMITTED, " An output descriptor" },
2034
+ {" " , RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, " An object with output descriptor and metadata" ,
2035
+ {
2036
+ {" desc" , RPCArg::Type::STR, RPCArg::Optional::NO, " An output descriptor" },
2037
+ {" range" , RPCArg::Type::RANGE, RPCArg::Default{1000 }, " The range of HD chain indexes to explore (either end or [begin,end])" },
2038
+ }},
2039
+ },
2040
+ RPCArgOptions{.oneline_description =" [scanobjects,...]" },
2041
+ };
2042
+
2043
+ static const auto scan_result_abort = RPCResult{
2044
+ " when action=='abort'" , RPCResult::Type::BOOL, " success" ,
2045
+ " True if scan will be aborted (not necessarily before this RPC returns), or false if there is no scan to abort"
2046
+ };
2047
+ static const auto scan_result_status_none = RPCResult{
2048
+ " when action=='status' and no scan is in progress - possibly already completed" , RPCResult::Type::NONE, " " , " "
2049
+ };
2050
+ static const auto scan_result_status_some = RPCResult{
2051
+ " when action=='status' and a scan is currently in progress" , RPCResult::Type::OBJ, " " , " " ,
2052
+ {{RPCResult::Type::NUM, " progress" , " Approximate percent complete" },}
2053
+ };
2054
+
2055
+
2022
2056
static RPCHelpMan scantxoutset ()
2023
2057
{
2024
2058
// scriptPubKey corresponding to mainnet address 12cbQLTFMXRnSzktFkuoG3eHoMeFtpTu3S
@@ -2038,21 +2072,8 @@ static RPCHelpMan scantxoutset()
2038
2072
" In the latter case, a range needs to be specified by below if different from 1000.\n "
2039
2073
" For more information on output descriptors, see the documentation in the doc/descriptors.md file.\n " ,
2040
2074
{
2041
- {" action" , RPCArg::Type::STR, RPCArg::Optional::NO, " The action to execute\n "
2042
- " \" start\" for starting a scan\n "
2043
- " \" abort\" for aborting the current scan (returns true when abort was successful)\n "
2044
- " \" status\" for progress report (in %) of the current scan" },
2045
- {" scanobjects" , RPCArg::Type::ARR, RPCArg::Optional::OMITTED, " Array of scan objects. Required for \" start\" action\n "
2046
- " Every scan object is either a string descriptor or an object:" ,
2047
- {
2048
- {" descriptor" , RPCArg::Type::STR, RPCArg::Optional::OMITTED, " An output descriptor" },
2049
- {" " , RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, " An object with output descriptor and metadata" ,
2050
- {
2051
- {" desc" , RPCArg::Type::STR, RPCArg::Optional::NO, " An output descriptor" },
2052
- {" range" , RPCArg::Type::RANGE, RPCArg::Default{1000 }, " The range of HD chain indexes to explore (either end or [begin,end])" },
2053
- }},
2054
- },
2055
- RPCArgOptions{.oneline_description =" [scanobjects,...]" }},
2075
+ scan_action_arg_desc,
2076
+ scan_objects_arg_desc,
2056
2077
},
2057
2078
{
2058
2079
RPCResult{" when action=='start'; only returns after scan completes" , RPCResult::Type::OBJ, " " , " " , {
@@ -2074,12 +2095,9 @@ static RPCHelpMan scantxoutset()
2074
2095
}},
2075
2096
{RPCResult::Type::STR_AMOUNT, " total_amount" , " The total amount of all found unspent outputs in " + CURRENCY_UNIT},
2076
2097
}},
2077
- RPCResult{" when action=='abort'" , RPCResult::Type::BOOL, " success" , " True if scan will be aborted (not necessarily before this RPC returns), or false if there is no scan to abort" },
2078
- RPCResult{" when action=='status' and a scan is currently in progress" , RPCResult::Type::OBJ, " " , " " ,
2079
- {
2080
- {RPCResult::Type::NUM, " progress" , " Approximate percent complete" },
2081
- }},
2082
- RPCResult{" when action=='status' and no scan is in progress - possibly already completed" , RPCResult::Type::NONE, " " , " " },
2098
+ scan_result_abort,
2099
+ scan_result_status_some,
2100
+ scan_result_status_none,
2083
2101
},
2084
2102
RPCExamples{
2085
2103
HelpExampleCli (" scantxoutset" , " start \' [\" " + EXAMPLE_DESCRIPTOR_RAW + " \" ]\' " ) +
0 commit comments