From 227b9dd2d6e1914edfec108af6bec5f12d9f6f39 Mon Sep 17 00:00:00 2001 From: Karl-Johan Alm Date: Mon, 2 Mar 2020 16:54:59 +0900 Subject: [PATCH] wallet/spkm: make GetOldestKeyPoolTime() const The method checks the oldest key time for key pools and returns the oldest. It does no modifications. --- src/wallet/scriptpubkeyman.cpp | 2 +- src/wallet/scriptpubkeyman.h | 4 ++-- src/wallet/wallet.cpp | 2 +- src/wallet/wallet.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp index 8ff00e802..8851d0af3 100644 --- a/src/wallet/scriptpubkeyman.cpp +++ b/src/wallet/scriptpubkeyman.cpp @@ -441,7 +441,7 @@ static int64_t GetOldestKeyTimeInPool(const std::set& setKeyPool, Walle return keypool.nTime; } -int64_t LegacyScriptPubKeyMan::GetOldestKeyPoolTime() +int64_t LegacyScriptPubKeyMan::GetOldestKeyPoolTime() const { LOCK(cs_KeyStore); diff --git a/src/wallet/scriptpubkeyman.h b/src/wallet/scriptpubkeyman.h index 9d227ad3b..1a0d34a44 100644 --- a/src/wallet/scriptpubkeyman.h +++ b/src/wallet/scriptpubkeyman.h @@ -194,7 +194,7 @@ public: //! The action to do when the DB needs rewrite virtual void RewriteDB() {} - virtual int64_t GetOldestKeyPoolTime() { return GetTime(); } + virtual int64_t GetOldestKeyPoolTime() const { return GetTime(); } virtual size_t KeypoolCountExternalKeys() const { return 0; } virtual unsigned int GetKeyPoolSize() const { return 0; } @@ -336,7 +336,7 @@ public: void RewriteDB() override; - int64_t GetOldestKeyPoolTime() override; + int64_t GetOldestKeyPoolTime() const override; size_t KeypoolCountExternalKeys() const override; unsigned int GetKeyPoolSize() const override; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 8f6dbbad5..bb227b975 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3177,7 +3177,7 @@ bool CWallet::GetNewChangeDestination(const OutputType type, CTxDestination& des return true; } -int64_t CWallet::GetOldestKeyPoolTime() +int64_t CWallet::GetOldestKeyPoolTime() const { LOCK(cs_wallet); int64_t oldestKey = std::numeric_limits::max(); diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 1dd9f779a..40c72a864 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -971,7 +971,7 @@ public: size_t KeypoolCountExternalKeys() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); bool TopUpKeyPool(unsigned int kpSize = 0); - int64_t GetOldestKeyPoolTime(); + int64_t GetOldestKeyPoolTime() const; std::set> GetAddressGroupings() EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); std::map GetAddressBalances(interfaces::Chain::Lock& locked_chain);