Skip to content

Commit

Permalink
wallet: Track scanning duration
Browse files Browse the repository at this point in the history
  • Loading branch information
promag committed Apr 28, 2019
1 parent bdd7217 commit 2ee811e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/wallet/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ class CWallet final : public CCryptoKeyStore, private interfaces::Chain::Notific
private:
std::atomic<bool> fAbortRescan{false};
std::atomic<bool> fScanningWallet{false}; // controlled by WalletRescanReserver
std::atomic<int64_t> m_scanning_start{0};
std::mutex mutexScanning;
friend class WalletRescanReserver;

Expand Down Expand Up @@ -820,6 +821,7 @@ class CWallet final : public CCryptoKeyStore, private interfaces::Chain::Notific
void AbortRescan() { fAbortRescan = true; }
bool IsAbortingRescan() { return fAbortRescan; }
bool IsScanning() { return fScanningWallet; }
int64_t ScanningDuration() const { return fScanningWallet ? GetTimeMillis() - m_scanning_start : 0; }

/**
* keystore implementation
Expand Down Expand Up @@ -1241,6 +1243,7 @@ class WalletRescanReserver
if (m_wallet->fScanningWallet) {
return false;
}
m_wallet->m_scanning_start = GetTimeMillis();
m_wallet->fScanningWallet = true;
m_could_reserve = true;
return true;
Expand Down

0 comments on commit 2ee811e

Please sign in to comment.