Bitcoin ABC  0.26.3
P2P Digital Currency
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
9 #include <coins.h>
10 #include <consensus/amount.h>
11 #include <core_memusage.h>
12 #include <indirectmap.h>
13 #include <kernel/cs_main.h>
14 #include <kernel/mempool_entry.h>
15 #include <kernel/mempool_options.h>
16 #include <policy/packages.h>
17 #include <primitives/transaction.h>
18 #include <radix.h>
19 #include <sync.h>
20 #include <uint256radixkey.h>
21 #include <util/hasher.h>
23 #include <boost/multi_index/hashed_index.hpp>
24 #include <boost/multi_index/ordered_index.hpp>
25 #include <boost/multi_index/sequenced_index.hpp>
26 #include <boost/multi_index_container.hpp>
28 #include <atomic>
29 #include <map>
30 #include <optional>
31 #include <set>
32 #include <string>
33 #include <unordered_map>
34 #include <utility>
35 #include <vector>
37 class CChain;
38 class Chainstate;
39 class Config;
45 static const uint32_t MEMPOOL_HEIGHT = 0x7FFFFFFF;
47 // extracts a transaction id from CTxMemPoolEntry or CTransactionRef
49  typedef TxId result_type;
52  return entry->GetTx().GetId();
53  }
56  return tx->GetId();
57  }
58 };
64  Uint256RadixKey getId(const CTxMemPoolEntry &entry) const {
65  return entry.GetSharedTx()->GetId();
66  }
67 };
69 // used by the entry_time index
72  const CTxMemPoolEntryRef &b) const {
73  return a->GetTime() < b->GetTime();
74  }
75 };
77 // used by the entry_id index
80  const CTxMemPoolEntryRef &b) const {
81  return a->GetEntryId() < b->GetEntryId();
82  }
83 };
92  // Used in tests
93  bool operator()(const CTxMemPoolEntry &a, const CTxMemPoolEntry &b) const {
94  const CFeeRate frA = a.GetModifiedFeeRate();
95  const CFeeRate frB = b.GetModifiedFeeRate();
97  // Sort by modified fee rate first
98  if (frA != frB) {
99  return frA > frB;
100  }
102  // Ties are broken by whichever is topologically earlier
103  // (this helps mining code avoid some backtracking).
104  if (a.GetEntryId() != b.GetEntryId()) {
105  return a.GetEntryId() < b.GetEntryId();
106  }
108  // If nothing else, sort by txid (this should never happen as entryID is
109  // expected to be unique).
110  return a.GetSharedTx()->GetId() < b.GetSharedTx()->GetId();
111  }
114  const CTxMemPoolEntryRef &b) const {
115  return operator()(*a, *b);
116  }
117 };
119 // Multi_index tag names
120 struct entry_time {};
122 struct entry_id {};
132  std::chrono::seconds m_time;
138  size_t vsize;
142 };
150  EXPIRY,
154  REORG,
156  BLOCK,
163 };
209 class CTxMemPool {
210 private:
212  const int m_check_ratio;
214  std::atomic<uint32_t> nTransactionsUpdated{0};
217  uint64_t totalTxSize GUARDED_BY(cs);
219  Amount m_total_fee GUARDED_BY(cs);
222  uint64_t cachedInnerUsage GUARDED_BY(cs);
224  mutable int64_t lastRollingFeeUpdate GUARDED_BY(cs);
225  mutable bool blockSinceLastRollingFeeBump GUARDED_BY(cs);
227  mutable double rollingMinimumFeeRate GUARDED_BY(cs);
229  // In-memory counter for external mempool tracking purposes.
230  // This number is incremented once every time a transaction
231  // is added or removed from the mempool for any reason.
232  mutable uint64_t m_sequence_number GUARDED_BY(cs){1};
236  bool m_load_tried GUARDED_BY(cs){false};
240  uint64_t nextEntryId GUARDED_BY(cs) = 1;
242 public:
243  // public only for testing
244  static const int ROLLING_FEE_HALFLIFE = 60 * 60 * 12;
246  typedef boost::multi_index_container<
248  boost::multi_index::indexed_by<
249  // indexed by txid
250  boost::multi_index::hashed_unique<mempoolentry_txid,
252  // sorted by fee rate
253  boost::multi_index::ordered_non_unique<
254  boost::multi_index::tag<modified_feerate>,
255  boost::multi_index::identity<CTxMemPoolEntryRef>,
257  // sorted by entry time
258  boost::multi_index::ordered_non_unique<
259  boost::multi_index::tag<entry_time>,
260  boost::multi_index::identity<CTxMemPoolEntryRef>,
262  // sorted topologically (insertion order)
263  boost::multi_index::ordered_unique<
264  boost::multi_index::tag<entry_id>,
265  boost::multi_index::identity<CTxMemPoolEntryRef>,
299  using txiter = indexed_transaction_set::nth_index<0>::type::const_iterator;
300  typedef std::set<txiter, CompareIteratorById> setEntries;
301  typedef std::set<txiter, CompareIteratorByRevEntryId> setRevTopoEntries;
305 private:
306  void UpdateParent(txiter entry, txiter parent, bool add)
308  void UpdateChild(txiter entry, txiter child, bool add)
315  std::set<TxId> m_unbroadcast_txids GUARDED_BY(cs);
323  bool CalculateAncestors(setEntries &setAncestors,
324  CTxMemPoolEntry::Parents &staged_ancestors) const
327 public:
329  std::map<TxId, Amount> mapDeltas GUARDED_BY(cs);
333  const int64_t m_max_size_bytes;
334  const std::chrono::seconds m_expiry;
338  const std::optional<unsigned> m_max_datacarrier_bytes;
339  const bool m_require_standard;
347  CTxMemPool(const Options &opts);
348  ~CTxMemPool();
356  void check(const CCoinsViewCache &active_coins_tip,
357  int64_t spendheight) const EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
359  // addUnchecked must update state for all parents of a given transaction,
360  // updating child links as necessary.
364  void removeRecursive(const CTransaction &tx, MemPoolRemovalReason reason)
369  void clear();
370  // lock free
372  bool CompareTopologically(const TxId &txida, const TxId &txidb) const;
373  void getAllTxIds(std::vector<TxId> &vtxid) const;
374  bool isSpent(const COutPoint &outpoint) const;
375  unsigned int GetTransactionsUpdated() const;
376  void AddTransactionsUpdated(unsigned int n);
382  bool HasNoInputsOf(const CTransaction &tx) const
386  void PrioritiseTransaction(const TxId &txid, const Amount nFeeDelta);
387  void ApplyDelta(const TxId &txid, Amount &nFeeDelta) const
392  const CTransaction *GetConflictTx(const COutPoint &prevout) const
396  std::optional<txiter> GetIter(const TxId &txid) const
403  setEntries GetIterSet(const std::set<TxId> &txids) const
411  void RemoveStaged(const setEntries &stage, MemPoolRemovalReason reason)
422  setEntries &setAncestors,
423  bool fSearchForParents = true) const
431  void CalculateDescendants(txiter it, setEntries &setDescendants) const
439  CFeeRate GetMinFee(size_t sizelimit) const;
447  void TrimToSize(size_t sizelimit,
448  std::vector<COutPoint> *pvNoSpendsRemaining = nullptr)
455  int Expire(std::chrono::seconds time) EXCLUSIVE_LOCKS_REQUIRED(cs);
460  void LimitSize(CCoinsViewCache &coins_cache)
467  bool GetLoadTried() const;
473  void SetLoadTried(bool load_tried);
475  unsigned long size() const {
476  LOCK(cs);
477  return mapTx.size();
478  }
482  return totalTxSize;
483  }
487  return m_total_fee;
488  }
490  bool exists(const TxId &txid) const {
491  LOCK(cs);
492  return mapTx.count(txid) != 0;
493  }
497  return finalizedTxs.insert(tx);
498  }
500  bool isAvalancheFinalized(const TxId &txid) const {
501  LOCK(cs);
502  return finalizedTxs.get(txid) != nullptr;
503  }
505  CTransactionRef get(const TxId &txid) const;
506  TxMempoolInfo info(const TxId &txid) const;
507  std::vector<TxMempoolInfo> infoAll() const;
509  CFeeRate estimateFee() const;
511  size_t DynamicMemoryUsage() const;
514  void AddUnbroadcastTx(const TxId &txid) {
515  LOCK(cs);
516  // Sanity check the transaction is in the mempool & insert into
517  // unbroadcast set.
518  if (exists(txid)) {
519  m_unbroadcast_txids.insert(txid);
520  }
521  }
524  void RemoveUnbroadcastTx(const TxId &txid, const bool unchecked = false);
527  std::set<TxId> GetUnbroadcastTxs() const {
528  LOCK(cs);
529  return m_unbroadcast_txids;
530  }
533  bool IsUnbroadcastTx(const TxId &txid) const EXCLUSIVE_LOCKS_REQUIRED(cs) {
535  return (m_unbroadcast_txids.count(txid) != 0);
536  }
540  return m_sequence_number++;
541  }
544  return m_sequence_number;
545  }
547 private:
549  void UpdateEntryForAncestors(txiter it, const setEntries *setAncestors)
559  void UpdateForRemoveFromMempool(const setEntries &entriesToRemove)
572  void removeUnchecked(txiter entry, MemPoolRemovalReason reason)
574 };
595  std::unordered_map<COutPoint, Coin, SaltedOutpointHasher> m_temp_added;
597 protected:
600 public:
601  CCoinsViewMemPool(CCoinsView *baseIn, const CTxMemPool &mempoolIn);
602  bool GetCoin(const COutPoint &outpoint, Coin &coin) const override;
608  void PackageAddTransaction(const CTransactionRef &tx);
609 };
An in-memory indexed chain of blocks.
Definition: chain.h:140
CCoinsView backed by another CCoinsView.
Definition: coins.h:184
CCoinsView that adds a memory cache for transactions to another CCoinsView.
Definition: coins.h:203
Abstract view on the open txout dataset.
Definition: coins.h:147
CCoinsView that brings transactions from a mempool into view.
Definition: txmempool.h:589
bool GetCoin(const COutPoint &outpoint, Coin &coin) const override
Retrieve the Coin (unspent transaction output) for a given outpoint.
Definition: txmempool.cpp:592
std::unordered_map< COutPoint, Coin, SaltedOutpointHasher > m_temp_added
Coins made available by transactions being validated.
Definition: txmempool.h:595
CCoinsViewMemPool(CCoinsView *baseIn, const CTxMemPool &mempoolIn)
Definition: txmempool.cpp:588
void PackageAddTransaction(const CTransactionRef &tx)
Add the coins created by this transaction.
Definition: txmempool.cpp:615
const CTxMemPool & mempool
Definition: txmempool.h:598
Fee rate in satoshis per kilobyte: Amount / kB.
Definition: feerate.h:21
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:20
The basic transaction that is broadcasted on the network and contained in blocks.
Definition: transaction.h:192
CTxMemPoolEntry stores data about the corresponding transaction, as well as data about all in-mempool...
Definition: mempool_entry.h:65
uint64_t GetEntryId() const
CTransactionRef GetSharedTx() const
CFeeRate GetModifiedFeeRate() const
std::set< std::reference_wrapper< const CTxMemPoolEntryRef >, CompareIteratorById > Parents
Definition: mempool_entry.h:70
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Definition: txmempool.h:209
void removeConflicts(const CTransaction &tx) EXCLUSIVE_LOCKS_REQUIRED(cs)
Definition: txmempool.cpp:288
bool isAvalancheFinalized(const TxId &txid) const
Definition: txmempool.h:500
CFeeRate estimateFee() const
Definition: txmempool.cpp:510
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...
Definition: txmempool.cpp:578
void ClearPrioritisation(const TxId &txid) EXCLUSIVE_LOCKS_REQUIRED(cs)
Definition: txmempool.cpp:548
std::set< txiter, CompareIteratorById > setEntries
Definition: txmempool.h:300
const bool m_require_standard
Definition: txmempool.h:339
void RemoveUnbroadcastTx(const TxId &txid, const bool unchecked=false)
Removes a transaction from the unbroadcast set.
Definition: txmempool.cpp:633
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
Definition: txmempool.cpp:787
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:28
void updateFeeForBlock() EXCLUSIVE_LOCKS_REQUIRED(cs)
Called when a block is connected.
Definition: txmempool.cpp:306
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:438
RecursiveMutex cs
This mutex needs to be locked when accessing mapTx or other members that are guarded by it.
Definition: txmempool.h:296
void trackPackageRemoved(const CFeeRate &rate) EXCLUSIVE_LOCKS_REQUIRED(cs)
Definition: txmempool.cpp:734
Amount GetTotalFee() const EXCLUSIVE_LOCKS_REQUIRED(cs)
Definition: txmempool.h:485
void removeRecursive(const CTransaction &tx, MemPoolRemovalReason reason) EXCLUSIVE_LOCKS_REQUIRED(cs)
Definition: txmempool.cpp:257
void UpdateForRemoveFromMempool(const setEntries &entriesToRemove) EXCLUSIVE_LOCKS_REQUIRED(cs)
For each transaction being removed, update ancestors and any direct children.
Definition: txmempool.cpp:100
bool blockSinceLastRollingFeeBump GUARDED_BY(cs)
const int m_check_ratio
Value n means that 1 times in n we check.
Definition: txmempool.h:212
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.
Definition: txmempool.cpp:742
const std::chrono::seconds m_expiry
Definition: txmempool.h:334
const std::optional< unsigned > m_max_datacarrier_bytes
Definition: txmempool.h:338
void AddTransactionsUpdated(unsigned int n)
Definition: txmempool.cpp:138
void UpdateChildrenForRemoval(txiter entry) EXCLUSIVE_LOCKS_REQUIRED(cs)
Sever link between specified transaction and direct children.
Definition: txmempool.cpp:90
bool CompareTopologically(const TxId &txida, const TxId &txidb) const
Definition: txmempool.cpp:444
TxMempoolInfo info(const TxId &txid) const
Definition: txmempool.cpp:500
const int64_t m_max_size_bytes
Definition: txmempool.h:333
void getAllTxIds(std::vector< TxId > &vtxid) const
Definition: txmempool.cpp:458
std::atomic< uint32_t > nTransactionsUpdated
Used by getblocktemplate to trigger CreateNewBlock() invocation.
Definition: txmempool.h:214
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.
Definition: txmempool.cpp:567
size_t DynamicMemoryUsage() const
Definition: txmempool.cpp:622
std::vector< TxMempoolInfo > infoAll() const
Definition: txmempool.cpp:476
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.
Definition: txmempool.cpp:675
bool setAvalancheFinalized(const CTxMemPoolEntryRef &tx) EXCLUSIVE_LOCKS_REQUIRED(cs)
Definition: txmempool.h:495
void UpdateParent(txiter entry, txiter parent, bool add) EXCLUSIVE_LOCKS_REQUIRED(cs)
Definition: txmempool.cpp:701
indirectmap< COutPoint, const CTransaction * > mapNextTx GUARDED_BY(cs)
void removeUnchecked(txiter entry, MemPoolRemovalReason reason) EXCLUSIVE_LOCKS_REQUIRED(cs)
Before calling removeUnchecked for a given transaction, UpdateForRemoveFromMempool must be called on ...
Definition: txmempool.cpp:190
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.
Definition: txmempool.cpp:656
void clear()
Definition: txmempool.cpp:325
std::set< txiter, CompareIteratorByRevEntryId > setRevTopoEntries
Definition: txmempool.h:301
bool exists(const TxId &txid) const
Definition: txmempool.h:490
std::map< TxId, Amount > mapDeltas GUARDED_BY(cs)
int64_t lastRollingFeeUpdate GUARDED_BY(cs)
const bool m_permit_bare_multisig
Definition: txmempool.h:337
bool m_load_tried GUARDED_BY(cs)
Definition: txmempool.h:236
static const int ROLLING_FEE_HALFLIFE
Definition: txmempool.h:244
CTransactionRef get(const TxId &txid) const
Definition: txmempool.cpp:490
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:267
const CFeeRate m_min_relay_feerate
Definition: txmempool.h:335
void PrioritiseTransaction(const TxId &txid, const Amount nFeeDelta)
Affect CreateNewBlock prioritisation of transactions.
Definition: txmempool.cpp:520
std::set< TxId > m_unbroadcast_txids GUARDED_BY(cs)
Track locally submitted transactions to periodically retry initial broadcast.
uint64_t GetSequence() const EXCLUSIVE_LOCKS_REQUIRED(cs)
Definition: txmempool.h:543
bool IsUnbroadcastTx(const TxId &txid) const EXCLUSIVE_LOCKS_REQUIRED(cs)
Returns whether a txid is in the unbroadcast set.
Definition: txmempool.h:533
indexed_transaction_set::nth_index< 0 >::type::const_iterator txiter
Definition: txmempool.h:299
uint64_t GetAndIncrementSequence() const EXCLUSIVE_LOCKS_REQUIRED(cs)
Guards this internal counter for external reporting.
Definition: txmempool.h:539
void UpdateChild(txiter entry, txiter child, bool add) EXCLUSIVE_LOCKS_REQUIRED(cs)
Definition: txmempool.cpp:691
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:361
RadixTree< CTxMemPoolEntry, MemPoolEntryRadixTreeAdapter > finalizedTxs
Definition: txmempool.h:303
double rollingMinimumFeeRate GUARDED_BY(cs)
minimum fee to get into the pool, decreases exponentially
CTxMemPool(const Options &opts)
Create a new CTxMemPool.
Definition: txmempool.cpp:116
const CTransaction * GetConflictTx(const COutPoint &prevout) const EXCLUSIVE_LOCKS_REQUIRED(cs)
Get the transaction in the pool that spends the same prevout.
Definition: txmempool.cpp:553
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:55
std::set< TxId > GetUnbroadcastTxs() const
Returns transactions in unbroadcast set.
Definition: txmempool.h:527
void CalculateDescendants(txiter it, setEntries &setDescendants) const EXCLUSIVE_LOCKS_REQUIRED(cs)
Populate setDescendants with all in-mempool descendants of hash.
Definition: txmempool.cpp:230
void RemoveStaged(const setEntries &stage, MemPoolRemovalReason reason) EXCLUSIVE_LOCKS_REQUIRED(cs)
Remove a set of transactions from the mempool.
Definition: txmempool.cpp:644
unsigned long size() const
Definition: txmempool.h:475
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:81
uint64_t m_sequence_number GUARDED_BY(cs)
Definition: txmempool.h:232
void ApplyDelta(const TxId &txid, Amount &nFeeDelta) const EXCLUSIVE_LOCKS_REQUIRED(cs)
Definition: txmempool.cpp:538
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...
Definition: txmempool.cpp:792
const CFeeRate m_dust_relay_feerate
Definition: txmempool.h:336
std::optional< txiter > GetIter(const TxId &txid) const EXCLUSIVE_LOCKS_REQUIRED(cs)
Returns an iterator to the given txid, if found.
Definition: txmempool.cpp:558
void check(const CCoinsViewCache &active_coins_tip, int64_t spendheight) const EXCLUSIVE_LOCKS_REQUIRED(void cs_main
Definition: txmempool.h:362
uint64_t GetTotalTxSize() const EXCLUSIVE_LOCKS_REQUIRED(cs)
Definition: txmempool.h:480
bool isSpent(const COutPoint &outpoint) const
Definition: txmempool.cpp:129
void AddUnbroadcastTx(const TxId &txid)
Adds a transaction to the unbroadcast set.
Definition: txmempool.h:514
unsigned int GetTransactionsUpdated() const
Definition: txmempool.cpp:134
Definition: txmempool.cpp:313
Chainstate stores and provides an API to update our local knowledge of the current best chain.
Definition: validation.h:628
A UTXO entry.
Definition: coins.h:27
Definition: config.h:17
Definition: rcu.h:85
Map whose keys are pointers, but are compared by their dereferenced values.
Definition: indirectmap.h:26
RCUPtr< CTxMemPoolEntry > CTxMemPoolEntryRef
Definition: mempool_entry.h:56
Implement std::hash so RCUPtr can be used as a key for maps or sets.
Definition: rcu.h:257
std::shared_ptr< const CTransaction > CTransactionRef
Definition: transaction.h:315
Definition: amount.h:19
Definition: txmempool.h:78
bool operator()(const CTxMemPoolEntryRef &a, const CTxMemPoolEntryRef &b) const
Definition: txmempool.h:79
Definition: txmempool.h:70
bool operator()(const CTxMemPoolEntryRef &a, const CTxMemPoolEntryRef &b) const
Definition: txmempool.h:71
Sort by feerate of entry (modfee/vsize) in descending order.
Definition: txmempool.h:91
bool operator()(const CTxMemPoolEntry &a, const CTxMemPoolEntry &b) const
Definition: txmempool.h:93
bool operator()(const CTxMemPoolEntryRef &a, const CTxMemPoolEntryRef &b) const
Definition: txmempool.h:113
Radix tree adapter for storing a CTxMemPoolEntry as a tree element.
Definition: txmempool.h:63
Uint256RadixKey getId(const CTxMemPoolEntry &entry) const
Definition: txmempool.h:64
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:127
Amount fee
Fee of the transaction.
Definition: txmempool.h:135
Amount nFeeDelta
The fee delta.
Definition: txmempool.h:141
CTransactionRef tx
The transaction itself.
Definition: txmempool.h:129
std::chrono::seconds m_time
Time the transaction entered the mempool.
Definition: txmempool.h:132
size_t vsize
Virtual size of the transaction.
Definition: txmempool.h:138
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:51
result_type operator()(const CTransactionRef &tx) const
Definition: txmempool.h:55
#define LOCK(cs)
Definition: sync.h:306
Definition: threadsafety.h:56
Reason why a transaction was removed from the mempool, this is passed to the notification signal.
Definition: txmempool.h:148
Removed in size limiting.
Removed for block.
Expired from mempool.
Removed by avalanche vote.
Removed for replacement.
Removed for conflict with in-block transaction.
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:45