Skip to content

Commit

Permalink
wallet: Make GetOldestKeyPoolTime return nullopt for blank wallets
Browse files Browse the repository at this point in the history
This change suppress the "keypoololdest" field in the getwalletinfo RPC
response for blank descriptor wallets.
  • Loading branch information
hebasto committed Nov 3, 2021
1 parent 3e4f069 commit ee03c78
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit ee03c78

Please sign in to comment.