Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
txmempool.h
Go to the documentation of this file.
1// Copyright (c) 2009-2010 Satoshi Nakamoto
2// Copyright (c) 2009-2016 The Bitcoin Core developers
3// Distributed under the MIT software license, see the accompanying
4// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6#ifndef BITCOIN_TXMEMPOOL_H
7#define BITCOIN_TXMEMPOOL_H
8
9#include <coins.h>
10#include <consensus/amount.h>
11#include <core_memusage.h>
12#include <indirectmap.h>
13#include <kernel/cs_main.h>
16#include <policy/packages.h>
18#include <radix.h>
19#include <sync.h>
20#include <txconflicting.h>
21#include <txorphanage.h>
22#include <uint256radixkey.h>
23#include <util/hasher.h>
24
25#include <boost/multi_index/hashed_index.hpp>
26#include <boost/multi_index/ordered_index.hpp>
27#include <boost/multi_index/sequenced_index.hpp>
28#include <boost/multi_index_container.hpp>
29
30#include <atomic>
31#include <map>
32#include <memory>
33#include <optional>
34#include <set>
35#include <string>
36#include <unordered_map>
37#include <utility>
38#include <vector>
39
40class CChain;
41class Chainstate;
42class Config;
43
48static const uint32_t MEMPOOL_HEIGHT = 0x7FFFFFFF;
49
50// extracts a transaction id from CTxMemPoolEntry or CTransactionRef
53
55 return entry->GetTx().GetId();
56 }
57
59 return tx->GetId();
60 }
61};
62
68 return entry.GetSharedTx()->GetId();
69 }
70};
71
72// used by the entry_time index
75 const CTxMemPoolEntryRef &b) const {
76 return a->GetTime() < b->GetTime();
77 }
78};
79
80// used by the entry_id index
83 const CTxMemPoolEntryRef &b) const {
84 return a->GetEntryId() < b->GetEntryId();
85 }
86};
87
95 // Used in tests
96 bool operator()(const CTxMemPoolEntry &a, const CTxMemPoolEntry &b) const {
97 const CFeeRate frA = a.GetModifiedFeeRate();
98 const CFeeRate frB = b.GetModifiedFeeRate();
99
100 // Sort by modified fee rate first
101 if (frA != frB) {
102 return frA > frB;
103 }
104
105 // Ties are broken by whichever is topologically earlier
106 // (this helps mining code avoid some backtracking).
107 if (a.GetEntryId() != b.GetEntryId()) {
108 return a.GetEntryId() < b.GetEntryId();
109 }
110
111 // If nothing else, sort by txid (this should never happen as entryID is
112 // expected to be unique).
113 return a.GetSharedTx()->GetId() < b.GetSharedTx()->GetId();
114 }
115
117 const CTxMemPoolEntryRef &b) const {
118 return operator()(*a, *b);
119 }
120};
121
122// Multi_index tag names
123struct entry_time {};
125struct entry_id {};
126
133
135 std::chrono::seconds m_time;
136
139
141 size_t vsize;
142
145};
146
153 EXPIRY,
155 SIZELIMIT,
157 REORG,
159 BLOCK,
161 CONFLICT,
163 AVALANCHE,
164};
165
166const std::string RemovalReasonToString(const MemPoolRemovalReason &r) noexcept;
167
213private:
215 const int m_check_ratio;
217 std::atomic<uint32_t> nTransactionsUpdated{0};
218
225 uint64_t cachedInnerUsage GUARDED_BY(cs);
226
231
232 // In-memory counter for external mempool tracking purposes.
233 // This number is incremented once every time a transaction
234 // is added or removed from the mempool for any reason.
236
238
240
244
247 std::unique_ptr<TxOrphanage> m_orphanage GUARDED_BY(cs_orphanage);
248
251 std::unique_ptr<TxConflicting> m_conflicting GUARDED_BY(cs_conflicting);
252
253public:
254 // public only for testing
255 static const int ROLLING_FEE_HALFLIFE = 60 * 60 * 12;
256
257 typedef boost::multi_index_container<
259 boost::multi_index::indexed_by<
260 // indexed by txid
261 boost::multi_index::hashed_unique<mempoolentry_txid,
263 // sorted by fee rate
264 boost::multi_index::ordered_non_unique<
265 boost::multi_index::tag<modified_feerate>,
266 boost::multi_index::identity<CTxMemPoolEntryRef>,
268 // sorted by entry time
269 boost::multi_index::ordered_non_unique<
270 boost::multi_index::tag<entry_time>,
271 boost::multi_index::identity<CTxMemPoolEntryRef>,
273 // sorted topologically (insertion order)
274 boost::multi_index::ordered_unique<
275 boost::multi_index::tag<entry_id>,
276 boost::multi_index::identity<CTxMemPoolEntryRef>,
279
309
310 using txiter = indexed_transaction_set::nth_index<0>::type::const_iterator;
311 typedef std::set<txiter, CompareIteratorById> setEntries;
312 typedef std::set<txiter, CompareIteratorByRevEntryId> setRevTopoEntries;
313
315
316private:
317 void UpdateParent(txiter entry, txiter parent, bool add)
319 void UpdateChild(txiter entry, txiter child, bool add)
321
327
337
338public:
340 std::map<TxId, Amount> mapDeltas GUARDED_BY(cs);
341
343
345 const std::chrono::seconds m_expiry;
349 const std::optional<unsigned> m_max_datacarrier_bytes;
351
358 CTxMemPool(const Options &opts);
359 ~CTxMemPool();
360
367 void check(const CCoinsViewCache &active_coins_tip,
369
370 // addUnchecked must update state for all parents of a given transaction,
371 // updating child links as necessary.
374
375 void removeRecursive(const CTransaction &tx, MemPoolRemovalReason reason)
377 void removeConflicts(const CTransaction &tx) EXCLUSIVE_LOCKS_REQUIRED(cs);
381
382 void clear();
383 // lock free
385 bool CompareTopologically(const TxId &txida, const TxId &txidb) const;
386 void getAllTxIds(std::vector<TxId> &vtxid) const;
387 bool isSpent(const COutPoint &outpoint) const;
388 unsigned int GetTransactionsUpdated() const;
389 void AddTransactionsUpdated(unsigned int n);
395 bool HasNoInputsOf(const CTransaction &tx) const
397
399 void PrioritiseTransaction(const TxId &txid, const Amount nFeeDelta);
400 void ApplyDelta(const TxId &txid, Amount &nFeeDelta) const
403
405 CTransactionRef GetConflictTx(const COutPoint &prevout) const
407
409 std::optional<txiter> GetIter(const TxId &txid) const
411
416 setEntries GetIterSet(const std::set<TxId> &txids) const
418
426
436 bool fSearchForParents = true) const
438
446
452 CFeeRate GetMinFee(size_t sizelimit) const;
453
460 void TrimToSize(size_t sizelimit,
461 std::vector<COutPoint> *pvNoSpendsRemaining = nullptr)
463
468 int Expire(std::chrono::seconds time) EXCLUSIVE_LOCKS_REQUIRED(cs);
469
475
480 bool GetLoadTried() const;
481
486 void SetLoadTried(bool load_tried);
487
488 unsigned long size() const {
489 LOCK(cs);
490 return mapTx.size();
491 }
492
497
502
503 bool exists(const TxId &txid) const {
504 LOCK(cs);
505 return mapTx.count(txid) != 0;
506 }
507
512
513 bool isAvalancheFinalized(const TxId &txid) const {
514 LOCK(cs);
515 return finalizedTxs.get(txid) != nullptr;
516 }
517
518 CTransactionRef get(const TxId &txid) const;
519 TxMempoolInfo info(const TxId &txid) const;
520 std::vector<TxMempoolInfo> infoAll() const;
521
522 CFeeRate estimateFee() const;
523
524 size_t DynamicMemoryUsage() const;
525
527 void AddUnbroadcastTx(const TxId &txid) {
528 LOCK(cs);
529 // Sanity check the transaction is in the mempool & insert into
530 // unbroadcast set.
531 if (exists(txid)) {
532 m_unbroadcast_txids.insert(txid);
533 }
534 }
535
537 void RemoveUnbroadcastTx(const TxId &txid, const bool unchecked = false);
538
540 std::set<TxId> GetUnbroadcastTxs() const {
541 LOCK(cs);
542 return m_unbroadcast_txids;
543 }
544
548 return (m_unbroadcast_txids.count(txid) != 0);
549 }
550
555
559
560 template <typename Callable>
561 auto withOrphanage(Callable &&func) const
565 return func(*m_orphanage);
566 }
567
568 template <typename Callable>
575
576private:
592
603};
604
624 std::unordered_map<COutPoint, Coin, SaltedOutpointHasher> m_temp_added;
625
631 mutable std::unordered_set<COutPoint, SaltedOutpointHasher>
633
634protected:
636
637public:
643 bool GetCoin(const COutPoint &outpoint, Coin &coin) const override;
651 std::unordered_set<COutPoint, SaltedOutpointHasher>
653 return m_non_base_coins;
654 }
656 void Reset();
657};
658
659#endif // BITCOIN_TXMEMPOOL_H
An in-memory indexed chain of blocks.
Definition chain.h:134
CCoinsView backed by another CCoinsView.
Definition coins.h:201
CCoinsView that adds a memory cache for transactions to another CCoinsView.
Definition coins.h:221
Abstract view on the open txout dataset.
Definition coins.h:163
CCoinsView that brings transactions from a mempool into view.
Definition txmempool.h:618
bool GetCoin(const COutPoint &outpoint, Coin &coin) const override
GetCoin, returning whether it exists and is not spent.
std::unordered_set< COutPoint, SaltedOutpointHasher > GetNonBaseCoins() const
Get all coins in m_non_base_coins.
Definition txmempool.h:652
void Reset()
Clear m_temp_added and m_non_base_coins.
std::unordered_map< COutPoint, Coin, SaltedOutpointHasher > m_temp_added
Coins made available by transactions being validated.
Definition txmempool.h:624
std::unordered_set< COutPoint, SaltedOutpointHasher > m_non_base_coins
Set of all coins that have been fetched from mempool or created using PackageAddTransaction (not base...
Definition txmempool.h:632
void PackageAddTransaction(const CTransactionRef &tx)
Add the coins created by this transaction.
const CTxMemPool & mempool
Definition txmempool.h:635
Fee rate in satoshis per kilobyte: Amount / kB.
Definition feerate.h:21
CTxMemPoolEntry stores data about the corresponding transaction, as well as data about all in-mempool...
CTransactionRef GetSharedTx() const
std::set< std::reference_wrapper< const CTxMemPoolEntryRef >, CompareIteratorById > Parents
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Definition txmempool.h:212
void removeConflicts(const CTransaction &tx) EXCLUSIVE_LOCKS_REQUIRED(cs)
bool isAvalancheFinalized(const TxId &txid) const
Definition txmempool.h:513
CFeeRate estimateFee() const
uint64_t nextEntryId GUARDED_BY(cs)
Used by addUnchecked to generate ever-increasing CTxMemPoolEntry::entryId's.
bool HasNoInputsOf(const CTransaction &tx) const EXCLUSIVE_LOCKS_REQUIRED(cs)
Check that none of this transactions inputs are in the mempool, and thus the tx is not dependent on o...
void ClearPrioritisation(const TxId &txid) EXCLUSIVE_LOCKS_REQUIRED(cs)
std::set< txiter, CompareIteratorById > setEntries
Definition txmempool.h:311
const bool m_require_standard
Definition txmempool.h:350
void RemoveUnbroadcastTx(const TxId &txid, const bool unchecked=false)
Removes a transaction from the unbroadcast set.
uint64_t cachedInnerUsage GUARDED_BY(cs)
sum of dynamic memory usage of all the map elements (NOT the maps themselves)
Amount m_total_fee GUARDED_BY(cs)
sum of all mempool tx's fees (NOT modified fee)
bool GetLoadTried() const
bool CalculateAncestors(setEntries &setAncestors, CTxMemPoolEntry::Parents &staged_ancestors) const EXCLUSIVE_LOCKS_REQUIRED(cs)
Helper function to calculate all in-mempool ancestors of staged_ancestors param@[in] staged_ancestors...
Definition txmempool.cpp:29
void updateFeeForBlock() EXCLUSIVE_LOCKS_REQUIRED(cs)
Called when a block is connected.
void UpdateEntryForAncestors(txiter it, const setEntries *setAncestors) EXCLUSIVE_LOCKS_REQUIRED(cs)
Set ancestor state for an entry.
CFeeRate GetMinFee() const
The minimum fee to get into the mempool, which may itself not be enough for larger-sized transactions...
Definition txmempool.h:451
RecursiveMutex cs
This mutex needs to be locked when accessing mapTx or other members that are guarded by it.
Definition txmempool.h:307
void trackPackageRemoved(const CFeeRate &rate) EXCLUSIVE_LOCKS_REQUIRED(cs)
Amount GetTotalFee() const EXCLUSIVE_LOCKS_REQUIRED(cs)
Definition txmempool.h:498
void removeRecursive(const CTransaction &tx, MemPoolRemovalReason reason) EXCLUSIVE_LOCKS_REQUIRED(cs)
void UpdateForRemoveFromMempool(const setEntries &entriesToRemove) EXCLUSIVE_LOCKS_REQUIRED(cs)
For each transaction being removed, update ancestors and any direct children.
bool blockSinceLastRollingFeeBump GUARDED_BY(cs)
const int m_check_ratio
Value n means that 1 times in n we check.
Definition txmempool.h:215
void TrimToSize(size_t sizelimit, std::vector< COutPoint > *pvNoSpendsRemaining=nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs)
Remove transactions from the mempool until its dynamic size is <= sizelimit.
const std::chrono::seconds m_expiry
Definition txmempool.h:345
const std::optional< unsigned > m_max_datacarrier_bytes
Definition txmempool.h:349
void AddTransactionsUpdated(unsigned int n)
void UpdateChildrenForRemoval(txiter entry) EXCLUSIVE_LOCKS_REQUIRED(cs)
Sever link between specified transaction and direct children.
Definition txmempool.cpp:91
bool CompareTopologically(const TxId &txida, const TxId &txidb) const
TxMempoolInfo info(const TxId &txid) const
std::map< TxId, Amount > mapDeltas GUARDED_BY(cs)
const int64_t m_max_size_bytes
Definition txmempool.h:344
void getAllTxIds(std::vector< TxId > &vtxid) const
std::atomic< uint32_t > nTransactionsUpdated
Used by getblocktemplate to trigger CreateNewBlock() invocation.
Definition txmempool.h:217
setEntries GetIterSet(const std::set< TxId > &txids) const EXCLUSIVE_LOCKS_REQUIRED(cs)
Translate a set of txids into a set of pool iterators to avoid repeated lookups.
std::unique_ptr< TxConflicting > m_conflicting GUARDED_BY(cs_conflicting)
Storage for conflicting txs information.
size_t DynamicMemoryUsage() const
std::vector< TxMempoolInfo > infoAll() const
indexed_transaction_set mapTx GUARDED_BY(cs)
void LimitSize(CCoinsViewCache &coins_cache) EXCLUSIVE_LOCKS_REQUIRED(cs
Reduce the size of the mempool by expiring and then trimming the mempool.
bool setAvalancheFinalized(const CTxMemPoolEntryRef &tx) EXCLUSIVE_LOCKS_REQUIRED(cs)
Definition txmempool.h:508
void UpdateParent(txiter entry, txiter parent, bool add) EXCLUSIVE_LOCKS_REQUIRED(cs)
CTransactionRef GetConflictTx(const COutPoint &prevout) const EXCLUSIVE_LOCKS_REQUIRED(cs)
Get the transaction in the pool that spends the same prevout.
void removeUnchecked(txiter entry, MemPoolRemovalReason reason) EXCLUSIVE_LOCKS_REQUIRED(cs)
Before calling removeUnchecked for a given transaction, UpdateForRemoveFromMempool must be called on ...
uint64_t totalTxSize GUARDED_BY(cs)
sum of all mempool tx's sizes.
int Expire(std::chrono::seconds time) EXCLUSIVE_LOCKS_REQUIRED(cs)
Expire all transaction (and their dependencies) in the mempool older than time.
void clear()
std::set< txiter, CompareIteratorByRevEntryId > setRevTopoEntries
Definition txmempool.h:312
bool exists(const TxId &txid) const
Definition txmempool.h:503
std::set< TxId > GetUnbroadcastTxs() const
Returns transactions in unbroadcast set.
Definition txmempool.h:540
int64_t lastRollingFeeUpdate GUARDED_BY(cs)
const bool m_permit_bare_multisig
Definition txmempool.h:348
bool m_load_tried GUARDED_BY(cs)
Definition txmempool.h:239
static const int ROLLING_FEE_HALFLIFE
Definition txmempool.h:255
auto withOrphanage(Callable &&func) const EXCLUSIVE_LOCKS_REQUIRED(!cs_orphanage)
Definition txmempool.h:561
CTransactionRef get(const TxId &txid) const
boost::multi_index_container< CTxMemPoolEntryRef, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< mempoolentry_txid, SaltedTxIdHasher >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< modified_feerate >, boost::multi_index::identity< CTxMemPoolEntryRef >, CompareTxMemPoolEntryByModifiedFeeRate >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< entry_time >, boost::multi_index::identity< CTxMemPoolEntryRef >, CompareTxMemPoolEntryByEntryTime >, boost::multi_index::ordered_unique< boost::multi_index::tag< entry_id >, boost::multi_index::identity< CTxMemPoolEntryRef >, CompareTxMemPoolEntryByEntryId > > > indexed_transaction_set
Definition txmempool.h:278
const CFeeRate m_min_relay_feerate
Definition txmempool.h:346
void PrioritiseTransaction(const TxId &txid, const Amount nFeeDelta)
Affect CreateNewBlock prioritisation of transactions.
uint64_t GetSequence() const EXCLUSIVE_LOCKS_REQUIRED(cs)
Definition txmempool.h:556
bool IsUnbroadcastTx(const TxId &txid) const EXCLUSIVE_LOCKS_REQUIRED(cs)
Returns whether a txid is in the unbroadcast set.
Definition txmempool.h:546
indexed_transaction_set::nth_index< 0 >::type::const_iterator txiter
Definition txmempool.h:310
uint64_t GetAndIncrementSequence() const EXCLUSIVE_LOCKS_REQUIRED(cs)
Guards this internal counter for external reporting.
Definition txmempool.h:552
void UpdateChild(txiter entry, txiter child, bool add) EXCLUSIVE_LOCKS_REQUIRED(cs)
void check(const CCoinsViewCache &active_coins_tip, int64_t spendheight) const EXCLUSIVE_LOCKS_REQUIRED(void addUnchecked(CTxMemPoolEntryRef entry) EXCLUSIVE_LOCKS_REQUIRED(cs
If sanity-checking is turned on, check makes sure the pool is consistent (does not contain two transa...
Definition txmempool.h:372
Mutex cs_orphanage
Definition txmempool.h:245
RadixTree< CTxMemPoolEntry, MemPoolEntryRadixTreeAdapter > finalizedTxs
Definition txmempool.h:314
void check(const CCoinsViewCache &active_coins_tip, int64_t spendheight) const EXCLUSIVE_LOCKS_REQUIRED(void cs_main
Definition txmempool.h:373
double rollingMinimumFeeRate GUARDED_BY(cs)
minimum fee to get into the pool, decreases exponentially
std::unique_ptr< TxOrphanage > m_orphanage GUARDED_BY(cs_orphanage)
Storage for orphan information.
auto withConflicting(Callable &&func) const EXCLUSIVE_LOCKS_REQUIRED(!cs_conflicting)
Definition txmempool.h:569
indirectmap< COutPoint, CTransactionRef > mapNextTx GUARDED_BY(cs)
bool CalculateMemPoolAncestors(const CTxMemPoolEntryRef &entry, setEntries &setAncestors, bool fSearchForParents=true) const EXCLUSIVE_LOCKS_REQUIRED(cs)
Try to calculate all in-mempool ancestors of entry.
Definition txmempool.cpp:56
void removeForFinalizedBlock(const std::vector< CTransactionRef > &vtx) EXCLUSIVE_LOCKS_REQUIRED(cs)
Mutex cs_conflicting
Definition txmempool.h:249
void CalculateDescendants(txiter it, setEntries &setDescendants) const EXCLUSIVE_LOCKS_REQUIRED(cs)
Populate setDescendants with all in-mempool descendants of hash.
void RemoveStaged(const setEntries &stage, MemPoolRemovalReason reason) EXCLUSIVE_LOCKS_REQUIRED(cs)
Remove a set of transactions from the mempool.
unsigned long size() const
Definition txmempool.h:488
void UpdateParentsOf(bool add, txiter it) EXCLUSIVE_LOCKS_REQUIRED(cs)
Update parents of it to add/remove it as a child transaction.
Definition txmempool.cpp:82
uint64_t m_sequence_number GUARDED_BY(cs)
Definition txmempool.h:235
void ApplyDelta(const TxId &txid, Amount &nFeeDelta) const EXCLUSIVE_LOCKS_REQUIRED(cs)
void SetLoadTried(bool load_tried)
Set whether or not we've made an attempt to load the mempool (regardless of whether the attempt was s...
const CFeeRate m_dust_relay_feerate
Definition txmempool.h:347
std::optional< txiter > GetIter(const TxId &txid) const EXCLUSIVE_LOCKS_REQUIRED(cs)
Returns an iterator to the given txid, if found.
std::set< TxId > m_unbroadcast_txids GUARDED_BY(cs)
Track locally submitted transactions to periodically retry initial broadcast.
uint64_t GetTotalTxSize() const EXCLUSIVE_LOCKS_REQUIRED(cs)
Definition txmempool.h:493
bool isSpent(const COutPoint &outpoint) const
void AddUnbroadcastTx(const TxId &txid)
Adds a transaction to the unbroadcast set.
Definition txmempool.h:527
unsigned int GetTransactionsUpdated() const
void _clear() EXCLUSIVE_LOCKS_REQUIRED(cs)
Chainstate stores and provides an API to update our local knowledge of the current best chain.
Definition validation.h:699
A UTXO entry.
Definition coins.h:28
Definition rcu.h:85
Map whose keys are pointers, but are compared by their dereferenced values.
Definition indirectmap.h:26
RCUPtr< CTxMemPoolEntry > CTxMemPoolEntryRef
Implement std::hash so RCUPtr can be used as a key for maps or sets.
Definition rcu.h:259
std::shared_ptr< const CTransaction > CTransactionRef
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition random.h:85
Definition txmempool.h:81
bool operator()(const CTxMemPoolEntryRef &a, const CTxMemPoolEntryRef &b) const
Definition txmempool.h:82
Definition txmempool.h:73
bool operator()(const CTxMemPoolEntryRef &a, const CTxMemPoolEntryRef &b) const
Definition txmempool.h:74
Sort by feerate of entry (modfee/vsize) in descending order.
Definition txmempool.h:94
bool operator()(const CTxMemPoolEntry &a, const CTxMemPoolEntry &b) const
Definition txmempool.h:96
bool operator()(const CTxMemPoolEntryRef &a, const CTxMemPoolEntryRef &b) const
Definition txmempool.h:116
Radix tree adapter for storing a CTxMemPoolEntry as a tree element.
Definition txmempool.h:66
Uint256RadixKey getId(const CTxMemPoolEntry &entry) const
Definition txmempool.h:67
This is a radix tree storing values identified by a unique key.
Definition radix.h:40
RCUPtr< T > get(const KeyType &key)
Get the value corresponding to a key.
Definition radix.h:118
bool insert(const RCUPtr< T > &value)
Insert a value into the tree.
Definition radix.h:112
A TxId is the identifier of a transaction.
Definition txid.h:14
Information about a mempool transaction.
Definition txmempool.h:130
Amount fee
Fee of the transaction.
Definition txmempool.h:138
Amount nFeeDelta
The fee delta.
Definition txmempool.h:144
CTransactionRef tx
The transaction itself.
Definition txmempool.h:132
std::chrono::seconds m_time
Time the transaction entered the mempool.
Definition txmempool.h:135
size_t vsize
Virtual size of the transaction.
Definition txmempool.h:141
Facility for using an uint256 as a radix tree key.
Options struct containing options for constructing a CTxMemPool.
result_type operator()(const CTxMemPoolEntryRef &entry) const
Definition txmempool.h:54
result_type operator()(const CTransactionRef &tx) const
Definition txmempool.h:58
#define LOCK(cs)
Definition sync.h:306
#define AssertLockHeld(cs)
Definition sync.h:146
#define EXCLUSIVE_LOCKS_REQUIRED(...)
MemPoolRemovalReason
Reason why a transaction was removed from the mempool, this is passed to the notification signal.
Definition txmempool.h:151
@ SIZELIMIT
Removed in size limiting.
@ BLOCK
Removed for block.
@ EXPIRY
Expired from mempool.
@ AVALANCHE
Removed by avalanche vote.
@ CONFLICT
Removed for conflict with in-block transaction.
@ REORG
Removed for reorganization.
static const uint32_t MEMPOOL_HEIGHT
Fake height value used in Coins to signify they are only in the memory pool(since 0....
Definition txmempool.h:48
const std::string RemovalReasonToString(const MemPoolRemovalReason &r) noexcept
assert(!tx.IsCoinBase())