Skip to content

Commit 2ee811e

Browse files
committed
wallet: Track scanning duration
1 parent bdd7217 commit 2ee811e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/wallet/wallet.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,7 @@ class CWallet final : public CCryptoKeyStore, private interfaces::Chain::Notific
596596
private:
597597
std::atomic<bool> fAbortRescan{false};
598598
std::atomic<bool> fScanningWallet{false}; // controlled by WalletRescanReserver
599+
std::atomic<int64_t> m_scanning_start{0};
599600
std::mutex mutexScanning;
600601
friend class WalletRescanReserver;
601602

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

824826
/**
825827
* keystore implementation
@@ -1241,6 +1243,7 @@ class WalletRescanReserver
12411243
if (m_wallet->fScanningWallet) {
12421244
return false;
12431245
}
1246+
m_wallet->m_scanning_start = GetTimeMillis();
12441247
m_wallet->fScanningWallet = true;
12451248
m_could_reserve = true;
12461249
return true;

0 commit comments

Comments
 (0)