Browse Source

[rpc] Add abortrescan command to RPC interface.

0.15
Kalle Alm 8 years ago committed by Karl-Johan Alm
parent
commit
9141622a0f
No known key found for this signature in database
GPG Key ID: 57AF762DB3353322
  1. 25
      src/wallet/rpcdump.cpp
  2. 2
      src/wallet/rpcwallet.cpp

25
src/wallet/rpcdump.cpp

@ -154,6 +154,31 @@ UniValue importprivkey(const JSONRPCRequest& request)
return NullUniValue; 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 ImportAddress(CWallet*, const CBitcoinAddress& address, const std::string& strLabel);
void ImportScript(CWallet* const pwallet, const CScript& script, const std::string& strLabel, bool isRedeemScript) void ImportScript(CWallet* const pwallet, const CScript& script, const std::string& strLabel, bool isRedeemScript)
{ {

2
src/wallet/rpcwallet.cpp

@ -2914,6 +2914,7 @@ UniValue bumpfee(const JSONRPCRequest& request)
return result; return result;
} }
extern UniValue abortrescan(const JSONRPCRequest& request); // in rpcdump.cpp
extern UniValue dumpprivkey(const JSONRPCRequest& request); // in rpcdump.cpp extern UniValue dumpprivkey(const JSONRPCRequest& request); // in rpcdump.cpp
extern UniValue importprivkey(const JSONRPCRequest& request); extern UniValue importprivkey(const JSONRPCRequest& request);
extern UniValue importaddress(const JSONRPCRequest& request); extern UniValue importaddress(const JSONRPCRequest& request);
@ -2930,6 +2931,7 @@ static const CRPCCommand commands[] =
{ "rawtransactions", "fundrawtransaction", &fundrawtransaction, false, {"hexstring","options"} }, { "rawtransactions", "fundrawtransaction", &fundrawtransaction, false, {"hexstring","options"} },
{ "hidden", "resendwallettransactions", &resendwallettransactions, true, {} }, { "hidden", "resendwallettransactions", &resendwallettransactions, true, {} },
{ "wallet", "abandontransaction", &abandontransaction, false, {"txid"} }, { "wallet", "abandontransaction", &abandontransaction, false, {"txid"} },
{ "wallet", "abortrescan", &abortrescan, false, {} },
{ "wallet", "addmultisigaddress", &addmultisigaddress, true, {"nrequired","keys","account"} }, { "wallet", "addmultisigaddress", &addmultisigaddress, true, {"nrequired","keys","account"} },
{ "wallet", "addwitnessaddress", &addwitnessaddress, true, {"address"} }, { "wallet", "addwitnessaddress", &addwitnessaddress, true, {"address"} },
{ "wallet", "backupwallet", &backupwallet, true, {"destination"} }, { "wallet", "backupwallet", &backupwallet, true, {"destination"} },

Loading…
Cancel
Save