Skip to content

Commit

Permalink
refactor: Replace all uses of boost::optional with our own Optional type
Browse files Browse the repository at this point in the history
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

Cherry-picked from: d314e8a
  • Loading branch information
laanwj authored and xanimo committed Mar 29, 2024
1 parent 10728af commit 4519621
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/txmempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "clientversion.h"
#include "consensus/consensus.h"
#include "consensus/validation.h"
#include "optional.h"
#include "validation.h"
#include "policy/policy.h"
#include "policy/fees.h"
Expand Down Expand Up @@ -179,9 +180,9 @@ 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++) {
txiter piter = mapTx.find(tx.vin[i].prevout.hash);
Optional<txiter> piter = mapTx.find(tx.vin[i].prevout.hash);
if (piter != mapTx.end()) {
parentHashes.insert(piter);
parentHashes.insert(*piter);
if (parentHashes.size() + 1 > limitAncestorCount) {
errString = strprintf("too many unconfirmed parents [limit: %u]", limitAncestorCount);
return false;
Expand Down
1 change: 1 addition & 0 deletions src/txmempool.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "coins.h"
#include "crypto/siphash.h"
#include "indirectmap.h"
#include "optional.h"
#include "primitives/transaction.h"
#include "sync.h"
#include "random.h"
Expand Down
3 changes: 2 additions & 1 deletion src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "compat.h"
#include "fs.h"
#include "optional.h"
#include "tinyformat.h"
#include "utiltime.h"

Expand Down Expand Up @@ -62,7 +63,7 @@ extern const char * const BITCOIN_PID_FILENAME;
*/
inline std::string _(const char* psz)
{
boost::optional<std::string> rv = translationInterface.Translate(psz);
Optional<std::string> rv = translationInterface.Translate(psz);
return rv ? (*rv) : psz;
}

Expand Down
1 change: 1 addition & 0 deletions src/wallet/coincontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#ifndef BITCOIN_WALLET_COINCONTROL_H
#define BITCOIN_WALLET_COINCONTROL_H

#include "optional.h"
#include "primitives/transaction.h"
#include "dogecoin-fees.h"

Expand Down

0 comments on commit 4519621

Please sign in to comment.