aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2021-10-30 22:19:22 +0300
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2021-11-03 10:35:47 +0200
commitee03c782ba61993d9e95fa499546cd14cee35445 (patch)
treec50e3899df1f2cbab79d6bbebda9ec38dc3e73aa /src
parent3e4f069d23cd2ea5de8fa3c4b1a761ab097ad56f (diff)
downloadbitcoin-ee03c782ba61993d9e95fa499546cd14cee35445.tar.xz
wallet: Make GetOldestKeyPoolTime return nullopt for blank wallets
This change suppress the "keypoololdest" field in the getwalletinfo RPC response for blank descriptor wallets.
Diffstat (limited to 'src')
-rw-r--r--src/wallet/wallet.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 904154c91d..e535a080f2 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -2172,6 +2172,10 @@ bool CWallet::GetNewChangeDestination(const OutputType type, CTxDestination& des
std::optional<int64_t> CWallet::GetOldestKeyPoolTime() const
{
LOCK(cs_wallet);
+ if (m_spk_managers.empty()) {
+ return std::nullopt;
+ }
+
std::optional<int64_t> oldest_key{std::numeric_limits<int64_t>::max()};
for (const auto& spk_man_pair : m_spk_managers) {
oldest_key = std::min(oldest_key, spk_man_pair.second->GetOldestKeyPoolTime());