mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 06:43:45 +01:00
refactor: Replace all uses of boost::optional with our own Optional type
After this:
- `boost::optional` is no longer used directly (only through `Optional`
which is an alias for it)
- `boost/optional.hpp` is only included in one place
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include <consensus/consensus.h>
|
||||
#include <consensus/tx_verify.h>
|
||||
#include <consensus/validation.h>
|
||||
#include <optional.h>
|
||||
#include <validation.h>
|
||||
#include <policy/policy.h>
|
||||
#include <policy/fees.h>
|
||||
@@ -155,7 +156,7 @@ bool CTxMemPool::CalculateMemPoolAncestors(const CTxMemPoolEntry &entry, setEntr
|
||||
// GetMemPoolParents() is only valid for entries in the mempool, so we
|
||||
// iterate mapTx to find parents.
|
||||
for (unsigned int i = 0; i < tx.vin.size(); i++) {
|
||||
boost::optional<txiter> piter = GetIter(tx.vin[i].prevout.hash);
|
||||
Optional<txiter> piter = GetIter(tx.vin[i].prevout.hash);
|
||||
if (piter) {
|
||||
parentHashes.insert(*piter);
|
||||
if (parentHashes.size() + 1 > limitAncestorCount) {
|
||||
@@ -860,11 +861,11 @@ const CTransaction* CTxMemPool::GetConflictTx(const COutPoint& prevout) const
|
||||
return it == mapNextTx.end() ? nullptr : it->second;
|
||||
}
|
||||
|
||||
boost::optional<CTxMemPool::txiter> CTxMemPool::GetIter(const uint256& txid) const
|
||||
Optional<CTxMemPool::txiter> CTxMemPool::GetIter(const uint256& txid) const
|
||||
{
|
||||
auto it = mapTx.find(txid);
|
||||
if (it != mapTx.end()) return it;
|
||||
return boost::optional<txiter>{};
|
||||
return Optional<txiter>{};
|
||||
}
|
||||
|
||||
CTxMemPool::setEntries CTxMemPool::GetIterSet(const std::set<uint256>& hashes) const
|
||||
|
||||
Reference in New Issue
Block a user