mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 23:07:59 +01:00
refactor: return std::nullopt instead of {}
In #21415 we decided to return `std::optional` rather than `{}` for uninitialized values. This PR repalces the two remaining usages of `{}` with `std::nullopt`. As a side-effect, this also quells the spurious GCC 10.2.x warning that we've had reported quite a few times. i.e #21318, #21248, #20797. ```bash txmempool.cpp: In member function ‘CTxMemPool::setEntries CTxMemPool::GetIterSet(const std::set<uint256>&) const’: txmempool.cpp:898:13: warning: ‘<anonymous>’ may be used uninitialized in this function [-Wmaybe-uninitialized] 898 | return {}; | ^ ```
This commit is contained in:
parent
d2a78ee928
commit
5294f0d5a9
2 changed files with 2 additions and 2 deletions
|
@ -895,7 +895,7 @@ std::optional<CTxMemPool::txiter> CTxMemPool::GetIter(const uint256& txid) const
|
|||
{
|
||||
auto it = mapTx.find(txid);
|
||||
if (it != mapTx.end()) return it;
|
||||
return {};
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
CTxMemPool::setEntries CTxMemPool::GetIterSet(const std::set<uint256>& hashes) const
|
||||
|
|
|
@ -5186,7 +5186,7 @@ std::optional<uint256> ChainstateManager::SnapshotBlockhash() const {
|
|||
// If a snapshot chainstate exists, it will always be our active.
|
||||
return m_active_chainstate->m_from_snapshot_blockhash;
|
||||
}
|
||||
return {};
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::vector<CChainState*> ChainstateManager::GetAll()
|
||||
|
|
Loading…
Add table
Reference in a new issue