Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/blockchain.cpp
Show First 20 Lines • Show All 2,528 Lines • ▼ Show 20 Lines | RPCHelpMan{ | ||||
" \"start\" for starting a " | " \"start\" for starting a " | ||||
"scan\n" | "scan\n" | ||||
" \"abort\" for aborting the " | " \"abort\" for aborting the " | ||||
"current scan (returns true when abort was successful)\n" | "current scan (returns true when abort was successful)\n" | ||||
" \"status\" for " | " \"status\" for " | ||||
"progress report (in %) of the current scan"}, | "progress report (in %) of the current scan"}, | ||||
{"scanobjects", | {"scanobjects", | ||||
RPCArg::Type::ARR, | RPCArg::Type::ARR, | ||||
RPCArg::Optional::NO, | RPCArg::Optional::OMITTED, | ||||
"Array of scan objects\n" | "Array of scan objects. Required for \"start\" action\n" | ||||
" Every scan object is either a " | " Every scan object is either a " | ||||
"string descriptor or an object:", | "string descriptor or an object:", | ||||
{ | { | ||||
{"descriptor", RPCArg::Type::STR, RPCArg::Optional::OMITTED, | {"descriptor", RPCArg::Type::STR, RPCArg::Optional::OMITTED, | ||||
"An output descriptor"}, | "An output descriptor"}, | ||||
{ | { | ||||
"", | "", | ||||
RPCArg::Type::OBJ, | RPCArg::Type::OBJ, | ||||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | if (request.params[0].get_str() == "status") { | ||||
return true; | return true; | ||||
} else if (request.params[0].get_str() == "start") { | } else if (request.params[0].get_str() == "start") { | ||||
CoinsViewScanReserver reserver; | CoinsViewScanReserver reserver; | ||||
if (!reserver.reserve()) { | if (!reserver.reserve()) { | ||||
throw JSONRPCError( | throw JSONRPCError( | ||||
RPC_INVALID_PARAMETER, | RPC_INVALID_PARAMETER, | ||||
"Scan already in progress, use action \"abort\" or \"status\""); | "Scan already in progress, use action \"abort\" or \"status\""); | ||||
} | } | ||||
if (request.params.size() < 2) { | |||||
throw JSONRPCError( | |||||
RPC_MISC_ERROR, | |||||
"scanobjects argument is required for the start action"); | |||||
} | |||||
std::set<CScript> needles; | std::set<CScript> needles; | ||||
std::map<CScript, std::string> descriptors; | std::map<CScript, std::string> descriptors; | ||||
Amount total_in = Amount::zero(); | Amount total_in = Amount::zero(); | ||||
// loop through the scan objects | // loop through the scan objects | ||||
for (const UniValue &scanobject : | for (const UniValue &scanobject : | ||||
request.params[1].get_array().getValues()) { | request.params[1].get_array().getValues()) { | ||||
FlatSigningProvider provider; | FlatSigningProvider provider; | ||||
▲ Show 20 Lines • Show All 306 Lines • Show Last 20 Lines |