aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.h
diff options
context:
space:
mode:
authorRyan Ofsky <ryan@ofsky.org>2022-06-08 23:05:16 -0300
committerw0xlt <94266259+w0xlt@users.noreply.github.com>2022-06-23 17:13:40 -0300
commit230a2f4cc3fab9f66b6c24ba809ddbea77755cb7 (patch)
tree093095c3206a56f0f6e765ae92d37ea09e9b374d /src/wallet/wallet.h
parenta89ddfbe22b6db5beda678c9493e08fec6144122 (diff)
downloadbitcoin-230a2f4cc3fab9f66b6c24ba809ddbea77755cb7.tar.xz
wallet test: Add unit test for wallet scan save_progress option
Diffstat (limited to 'src/wallet/wallet.h')
-rw-r--r--src/wallet/wallet.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 206a4417a7..5be2ad166a 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -896,8 +896,11 @@ void MaybeResendWalletTxs(WalletContext& context);
class WalletRescanReserver
{
private:
+ using Clock = std::chrono::steady_clock;
+ using NowFn = std::function<Clock::time_point()>;
CWallet& m_wallet;
bool m_could_reserve;
+ NowFn m_now;
public:
explicit WalletRescanReserver(CWallet& w) : m_wallet(w), m_could_reserve(false) {}
@@ -918,6 +921,10 @@ public:
return (m_could_reserve && m_wallet.fScanningWallet);
}
+ Clock::time_point now() const { return m_now ? m_now() : Clock::now(); };
+
+ void setNow(NowFn now) { m_now = std::move(now); }
+
~WalletRescanReserver()
{
if (m_could_reserve) {