[rpc] Add abortrescan command to RPC interface.
This commit is contained in:
@@ -155,6 +155,29 @@ UniValue importprivkey(const UniValue& params, bool fHelp)
|
||||
return NullUniValue;
|
||||
}
|
||||
|
||||
UniValue abortrescan(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
if (fHelp || params.size() > 0)
|
||||
throw 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(const CTxDestination& dest, const string& strLabel);
|
||||
void ImportScript(const CScript& script, const string& strLabel, bool isRedeemScript)
|
||||
{
|
||||
|
||||
@@ -2611,6 +2611,7 @@ UniValue fundrawtransaction(const UniValue& params, bool fHelp)
|
||||
return result;
|
||||
}
|
||||
|
||||
extern UniValue abortrescan(const UniValue& params, bool fHelp); // in rpcdump.cpp
|
||||
extern UniValue dumpprivkey(const UniValue& params, bool fHelp); // in rpcdump.cpp
|
||||
extern UniValue importprivkey(const UniValue& params, bool fHelp);
|
||||
extern UniValue importaddress(const UniValue& params, bool fHelp);
|
||||
@@ -2626,6 +2627,7 @@ static const CRPCCommand commands[] =
|
||||
{ "rawtransactions", "fundrawtransaction", &fundrawtransaction, false },
|
||||
{ "hidden", "resendwallettransactions", &resendwallettransactions, true },
|
||||
{ "wallet", "abandontransaction", &abandontransaction, false },
|
||||
{ "wallet", "abortrescan", &abortrescan, false },
|
||||
{ "wallet", "addmultisigaddress", &addmultisigaddress, true },
|
||||
{ "wallet", "backupwallet", &backupwallet, true },
|
||||
{ "wallet", "dumpprivkey", &dumpprivkey, true },
|
||||
|
||||
Reference in New Issue
Block a user