Skip to content

Commit ee03c78

Browse files
committed
wallet: Make GetOldestKeyPoolTime return nullopt for blank wallets
This change suppress the "keypoololdest" field in the getwalletinfo RPC response for blank descriptor wallets.
1 parent 3e4f069 commit ee03c78

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/wallet/wallet.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2172,6 +2172,10 @@ bool CWallet::GetNewChangeDestination(const OutputType type, CTxDestination& des
21722172
std::optional<int64_t> CWallet::GetOldestKeyPoolTime() const
21732173
{
21742174
LOCK(cs_wallet);
2175+
if (m_spk_managers.empty()) {
2176+
return std::nullopt;
2177+
}
2178+
21752179
std::optional<int64_t> oldest_key{std::numeric_limits<int64_t>::max()};
21762180
for (const auto& spk_man_pair : m_spk_managers) {
21772181
oldest_key = std::min(oldest_key, spk_man_pair.second->GetOldestKeyPoolTime());

0 commit comments

Comments
 (0)