mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
b6c748f84909212dce73e4b77aa125ed1e108a10 doc: Add release notes for 15730 (João Barbosa) d3e8458365ab29017241bc43204fe81cb7fd8530 rpc: Show scanning details in getwalletinfo (João Barbosa) 90e27abe37cc84c7b206f20d28aafe32e71e7209 wallet: Track current scanning progress (João Barbosa) 2ee811e6930cf76ea51e6826fe437ed888688adc wallet: Track scanning duration (João Barbosa) Pull request description: Closes #15724. ACKs for commit b6c748: MarcoFalke: re-utACK b6c748f849 (Only change since my last review is rebase, adding release notes, and returning false instead of null) laanwj: utACK b6c748f84909212dce73e4b77aa125ed1e108a10 jonatack: ACK b6c748f84909212dce73e4b77aa125ed1e108a10, only changes appear to be rebase for https://github.com/bitcoin/bitcoin/pull/15730#discussion_r280030617 and release notes. Tree-SHA512: 8ee98f971c15f66ce8138fc92c55e51abc9faf01866a31ac7ce2ad766aa2bb88559eabee3b5815d645c84cdf1c19dc35ec03f31461e39bc5f6040edec0b87116 Co-authored-by: Wladimir J. van der Laan <laanwj@gmail.com>
This commit is contained in:
parent
3ad4651db1
commit
b3bbc00dbc
@ -2768,6 +2768,11 @@ UniValue getwalletinfo(const JSONRPCRequest& request)
|
||||
" }\n"
|
||||
" ,...\n"
|
||||
" ]\n"
|
||||
" \"scanning\": (json object) current scanning details, or false if no scan is in progress\n"
|
||||
" {\n"
|
||||
" \"duration\" : xxxx (numeric) elapsed seconds since scan start\n"
|
||||
" \"progress\" : x.xxxx, (numeric) scanning progress percentage [0.0, 1.0]\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"\nExamples:\n"
|
||||
+ HelpExampleCli("getwalletinfo", "")
|
||||
@ -2821,6 +2826,14 @@ UniValue getwalletinfo(const JSONRPCRequest& request)
|
||||
}
|
||||
obj.push_back(Pair("hdaccounts", accounts));
|
||||
}
|
||||
if (pwallet->IsScanning()) {
|
||||
UniValue scanning(UniValue::VOBJ);
|
||||
scanning.pushKV("duration", pwallet->ScanningDuration() / 1000);
|
||||
scanning.pushKV("progress", pwallet->ScanningProgress());
|
||||
obj.pushKV("scanning", scanning);
|
||||
} else {
|
||||
obj.pushKV("scanning", false);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -2059,7 +2059,8 @@ CBlockIndex* CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, CBlock
|
||||
LOCK(cs_main);
|
||||
gvp = GuessVerificationProgress(chainParams.TxData(), pindex);
|
||||
}
|
||||
ShowProgress(_("Rescanning..."), std::max(1, std::min(99, (int)((gvp - dProgressStart) / (dProgressTip - dProgressStart) * 100))));
|
||||
m_scanning_progress = (gvp - dProgressStart) / (dProgressTip - dProgressStart);
|
||||
ShowProgress(_("Rescanning..."), std::max(1, std::min(99, (int)(m_scanning_progress * 100))));
|
||||
}
|
||||
if (GetTime() >= nNow + 60) {
|
||||
nNow = GetTime();
|
||||
|
@ -717,6 +717,8 @@ class CWallet final : public CCryptoKeyStore, public CValidationInterface
|
||||
private:
|
||||
std::atomic<bool> fAbortRescan;
|
||||
std::atomic<bool> fScanningWallet; //controlled by WalletRescanReserver
|
||||
std::atomic<int64_t> m_scanning_start{0};
|
||||
std::atomic<double> m_scanning_progress{0};
|
||||
std::mutex mutexScanning;
|
||||
friend class WalletRescanReserver;
|
||||
|
||||
@ -977,6 +979,8 @@ public:
|
||||
void AbortRescan() { fAbortRescan = true; }
|
||||
bool IsAbortingRescan() { return fAbortRescan; }
|
||||
bool IsScanning() { return fScanningWallet; }
|
||||
int64_t ScanningDuration() const { return fScanningWallet ? GetTimeMillis() - m_scanning_start : 0; }
|
||||
double ScanningProgress() const { return fScanningWallet ? (double) m_scanning_progress : 0; }
|
||||
|
||||
/**
|
||||
* keystore implementation
|
||||
@ -1348,6 +1352,8 @@ public:
|
||||
if (m_wallet->fScanningWallet) {
|
||||
return false;
|
||||
}
|
||||
m_wallet->m_scanning_start = GetTimeMillis();
|
||||
m_wallet->m_scanning_progress = 0;
|
||||
m_wallet->fScanningWallet = true;
|
||||
m_could_reserve = true;
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user