Initial implementation of abortrescan

This commit is contained in:
Duke Leto
2022-10-19 05:12:12 -04:00
parent 29ec7b5fb6
commit 6fda12612d
3 changed files with 50 additions and 0 deletions

View File

@@ -144,6 +144,36 @@ UniValue convertpassphrase(const UniValue& params, bool fHelp, const CPubKey& my
return ret;
}
UniValue abortrescan(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
if (!EnsureWalletIsAvailable(fHelp))
return NullUniValue;
if (fHelp || params.size() > 0)
throw runtime_error(
"abortrescan\n"
"\nAbort a currently running rescan.\n"
"\nUse 'getrescaninfo' to get rescan progress details.\n"
"\nReturns true if aborting rescan, false otherwise.\n"
"\nArguments: none\n"
"\nExamples:\n"
"\nAbort rescan :\n"
+ HelpExampleCli("abortrescan","")
+ "\nAs a JSON-RPC call\n"
+ HelpExampleRpc("abortrescan","")
);
if(!pwalletMain->fRescanning) {
LogPrintf("%s: no rescan running\n",__func__);
return false;
}
if(pwalletMain->IsAbortingRescan()) {
LogPrintf("%s: already aborting current rescan\n",__func__);
return false;
}
pwalletMain->AbortRescan();
return true;
}
UniValue getrescaninfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
if (!EnsureWalletIsAvailable(fHelp))