[rpc] Add abortrescan command to RPC interface.
This commit is contained in:
parent
75a08e7d17
commit
9141622a0f
2 changed files with 27 additions and 0 deletions
|
@ -154,6 +154,31 @@ UniValue importprivkey(const JSONRPCRequest& request)
|
|||
return NullUniValue;
|
||||
}
|
||||
|
||||
UniValue abortrescan(const JSONRPCRequest& request)
|
||||
{
|
||||
CWallet* const pwallet = GetWalletForJSONRPCRequest(request);
|
||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
|
||||
return NullUniValue;
|
||||
}
|
||||
|
||||
if (request.fHelp || request.params.size() > 0)
|
||||
throw std::runtime_error(
|
||||
"abortrescan\n"
|
||||
"\nStops current wallet rescan triggered e.g. by an importprivkey call.\n"
|
||||
"\nExamples:\n"
|
||||
"\nImport a private key\n"
|
||||
+ HelpExampleCli("importprivkey", "\"mykey\"") +
|
||||
"\nAbort the running wallet rescan\n"
|
||||
+ HelpExampleCli("abortrescan", "") +
|
||||
"\nAs a JSON-RPC call\n"
|
||||
+ HelpExampleRpc("abortrescan", "")
|
||||
);
|
||||
|
||||
if (!pwallet->IsScanning() || pwallet->IsAbortingRescan()) return false;
|
||||
pwallet->AbortRescan();
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImportAddress(CWallet*, const CBitcoinAddress& address, const std::string& strLabel);
|
||||
void ImportScript(CWallet* const pwallet, const CScript& script, const std::string& strLabel, bool isRedeemScript)
|
||||
{
|
||||
|
|
|
@ -2914,6 +2914,7 @@ UniValue bumpfee(const JSONRPCRequest& request)
|
|||
return result;
|
||||
}
|
||||
|
||||
extern UniValue abortrescan(const JSONRPCRequest& request); // in rpcdump.cpp
|
||||
extern UniValue dumpprivkey(const JSONRPCRequest& request); // in rpcdump.cpp
|
||||
extern UniValue importprivkey(const JSONRPCRequest& request);
|
||||
extern UniValue importaddress(const JSONRPCRequest& request);
|
||||
|
@ -2930,6 +2931,7 @@ static const CRPCCommand commands[] =
|
|||
{ "rawtransactions", "fundrawtransaction", &fundrawtransaction, false, {"hexstring","options"} },
|
||||
{ "hidden", "resendwallettransactions", &resendwallettransactions, true, {} },
|
||||
{ "wallet", "abandontransaction", &abandontransaction, false, {"txid"} },
|
||||
{ "wallet", "abortrescan", &abortrescan, false, {} },
|
||||
{ "wallet", "addmultisigaddress", &addmultisigaddress, true, {"nrequired","keys","account"} },
|
||||
{ "wallet", "addwitnessaddress", &addwitnessaddress, true, {"address"} },
|
||||
{ "wallet", "backupwallet", &backupwallet, true, {"destination"} },
|
||||
|
|
Loading…
Add table
Reference in a new issue