wallet, refactor: Make GetOldestKeyPoolTime return type std::optional

This change gets rid of the magic number 0 in the
DescriptorScriptPubKeyMan::GetOldestKeyPoolTime() function.

No behavior change.
This commit is contained in:
Hennadii Stepanov
2021-10-30 22:19:22 +03:00
parent 7efc628539
commit 3e4f069d23
5 changed files with 15 additions and 15 deletions

View File

@ -2169,14 +2169,14 @@ bool CWallet::GetNewChangeDestination(const OutputType type, CTxDestination& des
return true;
}
int64_t CWallet::GetOldestKeyPoolTime() const
std::optional<int64_t> CWallet::GetOldestKeyPoolTime() const
{
LOCK(cs_wallet);
int64_t oldestKey = std::numeric_limits<int64_t>::max();
std::optional<int64_t> oldest_key{std::numeric_limits<int64_t>::max()};
for (const auto& spk_man_pair : m_spk_managers) {
oldestKey = std::min(oldestKey, spk_man_pair.second->GetOldestKeyPoolTime());
oldest_key = std::min(oldest_key, spk_man_pair.second->GetOldestKeyPoolTime());
}
return oldestKey;
return oldest_key;
}
void CWallet::MarkDestinationsDirty(const std::set<CTxDestination>& destinations) {