mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Give an error when rescan is aborted by the user
This commit is contained in:
parent
69b01e6f8b
commit
ae1d2b0308
@ -172,7 +172,13 @@ UniValue importprivkey(const JSONRPCRequest& request)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fRescan) {
|
if (fRescan) {
|
||||||
pwallet->RescanFromTime(TIMESTAMP_MIN, reserver, true /* update */);
|
int64_t scanned_time = pwallet->RescanFromTime(TIMESTAMP_MIN, reserver, true /* update */);
|
||||||
|
if (pwallet->IsAbortingRescan()) {
|
||||||
|
throw JSONRPCError(RPC_MISC_ERROR, "Rescan aborted by user.");
|
||||||
|
}
|
||||||
|
if (scanned_time > TIMESTAMP_MIN) {
|
||||||
|
throw JSONRPCError(RPC_WALLET_ERROR, "Rescan was unable to fully rescan the blockchain. Some transactions may be missing.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NullUniValue;
|
return NullUniValue;
|
||||||
@ -310,7 +316,13 @@ UniValue importaddress(const JSONRPCRequest& request)
|
|||||||
}
|
}
|
||||||
if (fRescan)
|
if (fRescan)
|
||||||
{
|
{
|
||||||
pwallet->RescanFromTime(TIMESTAMP_MIN, reserver, true /* update */);
|
int64_t scanned_time = pwallet->RescanFromTime(TIMESTAMP_MIN, reserver, true /* update */);
|
||||||
|
if (pwallet->IsAbortingRescan()) {
|
||||||
|
throw JSONRPCError(RPC_MISC_ERROR, "Rescan aborted by user.");
|
||||||
|
}
|
||||||
|
if (scanned_time > TIMESTAMP_MIN) {
|
||||||
|
throw JSONRPCError(RPC_WALLET_ERROR, "Rescan was unable to fully rescan the blockchain. Some transactions may be missing.");
|
||||||
|
}
|
||||||
pwallet->ReacceptWalletTransactions();
|
pwallet->ReacceptWalletTransactions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -479,7 +491,13 @@ UniValue importpubkey(const JSONRPCRequest& request)
|
|||||||
}
|
}
|
||||||
if (fRescan)
|
if (fRescan)
|
||||||
{
|
{
|
||||||
pwallet->RescanFromTime(TIMESTAMP_MIN, reserver, true /* update */);
|
int64_t scanned_time = pwallet->RescanFromTime(TIMESTAMP_MIN, reserver, true /* update */);
|
||||||
|
if (pwallet->IsAbortingRescan()) {
|
||||||
|
throw JSONRPCError(RPC_MISC_ERROR, "Rescan aborted by user.");
|
||||||
|
}
|
||||||
|
if (scanned_time > TIMESTAMP_MIN) {
|
||||||
|
throw JSONRPCError(RPC_WALLET_ERROR, "Rescan was unable to fully rescan the blockchain. Some transactions may be missing.");
|
||||||
|
}
|
||||||
pwallet->ReacceptWalletTransactions();
|
pwallet->ReacceptWalletTransactions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -604,7 +622,14 @@ UniValue importwallet(const JSONRPCRequest& request)
|
|||||||
uiInterface.ShowProgress("", 100, false); // hide progress dialog in GUI
|
uiInterface.ShowProgress("", 100, false); // hide progress dialog in GUI
|
||||||
pwallet->UpdateTimeFirstKey(nTimeBegin);
|
pwallet->UpdateTimeFirstKey(nTimeBegin);
|
||||||
}
|
}
|
||||||
pwallet->RescanFromTime(nTimeBegin, reserver, false /* update */);
|
uiInterface.ShowProgress("", 100, false); // hide progress dialog in GUI
|
||||||
|
int64_t scanned_time = pwallet->RescanFromTime(nTimeBegin, reserver, false /* update */);
|
||||||
|
if (pwallet->IsAbortingRescan()) {
|
||||||
|
throw JSONRPCError(RPC_MISC_ERROR, "Rescan aborted by user.");
|
||||||
|
}
|
||||||
|
if (scanned_time > nTimeBegin) {
|
||||||
|
throw JSONRPCError(RPC_WALLET_ERROR, "Rescan was unable to fully rescan the blockchain. Some transactions may be missing.");
|
||||||
|
}
|
||||||
pwallet->MarkDirty();
|
pwallet->MarkDirty();
|
||||||
|
|
||||||
if (!fGood)
|
if (!fGood)
|
||||||
@ -1214,6 +1239,9 @@ UniValue importmulti(const JSONRPCRequest& mainRequest)
|
|||||||
int64_t scannedTime = pwallet->RescanFromTime(nLowestTimestamp, reserver, true /* update */);
|
int64_t scannedTime = pwallet->RescanFromTime(nLowestTimestamp, reserver, true /* update */);
|
||||||
pwallet->ReacceptWalletTransactions();
|
pwallet->ReacceptWalletTransactions();
|
||||||
|
|
||||||
|
if (pwallet->IsAbortingRescan()) {
|
||||||
|
throw JSONRPCError(RPC_MISC_ERROR, "Rescan aborted by user.");
|
||||||
|
}
|
||||||
if (scannedTime > nLowestTimestamp) {
|
if (scannedTime > nLowestTimestamp) {
|
||||||
std::vector<UniValue> results = response.getValues();
|
std::vector<UniValue> results = response.getValues();
|
||||||
response.clear();
|
response.clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user