34 while (!staged_ancestors.empty()) {
35 const auto stage = staged_ancestors.begin()->get();
37 txiter stageit = mapTx.find(stage->GetTx().GetId());
38 assert(stageit != mapTx.end());
39 setAncestors.insert(stageit);
40 staged_ancestors.erase(staged_ancestors.begin());
43 (*stageit)->GetMemPoolParentsConst();
44 for (
const auto &parent : parents) {
45 txiter parent_it = mapTx.find(parent.get()->GetTx().GetId());
46 assert(parent_it != mapTx.end());
49 if (setAncestors.count(parent_it) == 0) {
50 staged_ancestors.insert(parent);
60 bool fSearchForParents )
const {
62 const CTransaction &tx = entry->GetTx();
64 if (fSearchForParents) {
68 for (
const CTxIn &in : tx.vin) {
69 std::optional<txiter> piter =
GetIter(in.prevout.GetTxId());
73 staged_ancestors.insert(**piter);
78 staged_ancestors = entry->GetMemPoolParentsConst();
86 for (
const auto &parent : (*it)->GetMemPoolParentsConst()) {
87 auto parent_it = mapTx.find(parent.get()->GetTx().GetId());
88 assert(parent_it != mapTx.end());
95 (*it)->GetMemPoolChildrenConst();
96 for (
const auto &child : children) {
97 auto updateIt = mapTx.find(child.get()->GetTx().GetId());
98 assert(updateIt != mapTx.end());
104 for (
txiter removeIt : entriesToRemove) {
114 for (
txiter removeIt : entriesToRemove) {
120 : m_check_ratio(opts.check_ratio),
121 m_finalizedTxsFitter(
node::BlockFitter(config)),
124 m_max_size_bytes{opts.max_size_bytes}, m_expiry{opts.expiry},
125 m_min_relay_feerate{opts.min_relay_feerate},
126 m_dust_relay_feerate{opts.dust_relay_feerate},
127 m_permit_bare_multisig{opts.permit_bare_multisig},
128 m_max_datacarrier_bytes{opts.max_datacarrier_bytes},
129 m_require_standard{opts.require_standard} {
138 return mapNextTx.count(outpoint);
151 entry->SetEntryId(nextEntryId++);
157 entry->UpdateFeeDelta(feeDelta);
162 auto [newit, inserted] = mapTx.insert(entry);
173 cachedInnerUsage += entry->DynamicMemoryUsage();
176 std::set<TxId> setParentTransactions;
177 for (
const CTxIn &in : tx->vin) {
178 mapNextTx.insert(std::make_pair(&in.prevout, tx));
179 setParentTransactions.insert(in.prevout.GetTxId());
186 for (
const auto &pit :
GetIterSet(setParentTransactions)) {
193 totalTxSize += entry->GetTxSize();
194 m_total_fee += entry->GetFee();
202 const TxId &txid = (*it)->GetTx().GetId();
210 (*it)->GetSharedTx(), reason, mempool_sequence);
213 m_finalizedTxsFitter.removeTxUnchecked(removed_tx->GetTxSize(),
214 removed_tx->GetSigChecks(),
215 removed_tx->GetFee());
219 for (
const CTxIn &txin : (*it)->GetTx().vin) {
220 mapNextTx.erase(txin.prevout);
226 totalTxSize -= (*it)->GetTxSize();
227 m_total_fee -= (*it)->GetFee();
228 cachedInnerUsage -= (*it)->DynamicMemoryUsage();
245 if (setDescendants.count(entryit) == 0) {
246 stage.insert(entryit);
251 while (!stage.empty()) {
252 txiter it = *stage.begin();
253 setDescendants.insert(it);
254 stage.erase(stage.begin());
257 (*it)->GetMemPoolChildrenConst();
258 for (
const auto &child : children) {
259 txiter childiter = mapTx.find(child.get()->GetTx().GetId());
260 assert(childiter != mapTx.end());
262 if (!setDescendants.count(childiter)) {
263 stage.insert(childiter);
274 txiter origit = mapTx.find(origTx.GetId());
275 if (origit != mapTx.end()) {
276 txToRemove.insert(origit);
282 auto it = mapNextTx.lower_bound(COutPoint(origTx.GetId(), 0));
283 while (it != mapNextTx.end() &&
284 it->first->GetTxId() == origTx.GetId()) {
285 txiter nextit = mapTx.find(it->second->GetId());
286 assert(nextit != mapTx.end());
287 txToRemove.insert(nextit);
293 for (
txiter it : txToRemove) {
303 for (
const CTxIn &txin : tx.vin) {
304 auto it = mapNextTx.find(txin.prevout);
305 if (it != mapNextTx.end()) {
306 const CTransaction &txConflict = *it->second;
307 if (txConflict != tx) {
324 lastRollingFeeUpdate =
GetTime();
325 blockSinceLastRollingFeeBump =
true;
329 const std::vector<CTransactionRef> &vtx) {
332 for (
const auto &tx : vtx) {
338 m_finalizedTxsFitter.removeTxUnchecked(removed_tx->GetTxSize(),
339 removed_tx->GetSigChecks(),
340 removed_tx->GetFee());
350 cachedInnerUsage = 0;
351 lastRollingFeeUpdate =
GetTime();
352 blockSinceLastRollingFeeBump =
false;
353 rollingMinimumFeeRate = 0;
363 int64_t spendheight)
const {
375 "Checking mempool with %u transactions and %u inputs\n",
376 (
unsigned int)mapTx.size(), (
unsigned int)mapNextTx.size());
378 uint64_t checkTotal = 0;
380 uint64_t innerUsage = 0;
386 checkTotal += entry->GetTxSize();
387 check_total_fee += entry->GetFee();
388 innerUsage += entry->DynamicMemoryUsage();
389 const CTransaction &tx = entry->GetTx();
394 for (
const CTxIn &txin : tx.vin) {
397 txiter parentIt = mapTx.find(txin.prevout.GetTxId());
398 if (parentIt != mapTx.end()) {
399 const CTransaction &parentTx = (*parentIt)->GetTx();
400 assert(parentTx.vout.size() > txin.prevout.GetN() &&
401 !parentTx.vout[txin.prevout.GetN()].IsNull());
402 setParentCheck.insert(*parentIt);
405 assert((*parentIt)->GetEntryId() < entry->GetEntryId());
411 assert(mempoolDuplicate.HaveCoin(txin.prevout));
413 auto prevoutNextIt = mapNextTx.find(txin.prevout);
414 assert(prevoutNextIt != mapNextTx.end());
415 assert(prevoutNextIt->first == &txin.prevout);
416 assert(prevoutNextIt->second.get() == &tx);
418 auto comp = [](
const auto &a,
const auto &b) ->
bool {
419 return a.get()->GetTx().GetId() == b.get()->GetTx().GetId();
421 assert(setParentCheck.size() == entry->GetMemPoolParentsConst().size());
422 assert(std::equal(setParentCheck.begin(), setParentCheck.end(),
423 entry->GetMemPoolParentsConst().begin(), comp));
433 for (
const auto &ancestor : setAncestors) {
434 assert((*ancestor)->GetEntryId() < entry->GetEntryId());
439 auto iter = mapNextTx.lower_bound(COutPoint(entry->GetTx().GetId(), 0));
440 for (; iter != mapNextTx.end() &&
441 iter->first->GetTxId() == entry->GetTx().GetId();
443 txiter childIt = mapTx.find(iter->second->GetId());
445 assert(childIt != mapTx.end());
446 setChildrenCheck.insert(*childIt);
448 assert(setChildrenCheck.size() ==
449 entry->GetMemPoolChildrenConst().size());
450 assert(std::equal(setChildrenCheck.begin(), setChildrenCheck.end(),
451 entry->GetMemPoolChildrenConst().begin(), comp));
458 spendheight, txfee));
459 for (
const auto &input : tx.vin) {
460 mempoolDuplicate.SpendCoin(input.prevout);
462 AddCoins(mempoolDuplicate, tx, std::numeric_limits<int>::max());
465 for (
auto &[
_, nextTx] : mapNextTx) {
466 txiter it = mapTx.find(nextTx->GetId());
467 assert(it != mapTx.end());
468 assert((*it)->GetSharedTx() == nextTx);
471 assert(totalTxSize == checkTotal);
472 assert(m_total_fee == check_total_fee);
473 assert(innerUsage == cachedInnerUsage);
477 const TxId &txidb)
const {
479 auto it1 = mapTx.find(txida);
480 if (it1 == mapTx.end()) {
483 auto it2 = mapTx.find(txidb);
484 if (it2 == mapTx.end()) {
487 return (*it1)->GetEntryId() < (*it2)->GetEntryId();
494 vtxid.reserve(mapTx.size());
497 vtxid.push_back(entry->GetTx().GetId());
502GetInfo(CTxMemPool::indexed_transaction_set::const_iterator it) {
504 (*it)->GetFee(), (*it)->GetTxSize(),
505 (*it)->GetModifiedFee() - (*it)->GetFee()};
511 std::vector<TxMempoolInfo> ret;
512 ret.reserve(mapTx.size());
514 const auto &index = mapTx.get<
entry_id>();
515 for (
auto it = index.begin(); it != index.end(); ++it) {
516 ret.push_back(
GetInfo(mapTx.project<0>(it)));
523 std::vector<TxId> &finalizedTxIds) {
526 auto it = mapTx.find(tx->GetTx().GetId());
527 if (it == mapTx.end()) {
533 setAncestors.insert(it);
542 uint64_t sumOfTxSize{0};
543 uint64_t sumOfTxSigChecks{0};
544 for (
auto iter_it = setAncestors.begin(); iter_it != setAncestors.end();) {
548 if (m_finalizedTxsFitter.isBelowBlockMinFeeRate(
549 entry->GetModifiedFeeRate())) {
551 "Delay storing finalized tx %s due to fee rate below the "
552 "block mininmum%s (see -blockmintxfee)\n",
553 tx->GetTx().GetId().ToString(),
554 entry->GetSharedTx()->GetId() == tx->GetSharedTx()->GetId()
557 entry->GetSharedTx()->GetId().ToString()));
564 iter_it = setAncestors.erase(iter_it);
568 sumOfTxSize += entry->GetTxSize();
569 sumOfTxSigChecks += entry->GetSigChecks();
573 if (!m_finalizedTxsFitter.testTxFits(sumOfTxSize, sumOfTxSigChecks)) {
576 "Delay storing finalized tx %s as it won't fit in the next block\n",
577 tx->GetTx().GetId().ToString());
581 finalizedTxIds.clear();
585 for (
txiter ancestor_it : setAncestors) {
587 m_finalizedTxsFitter.addTx((*ancestor_it)->GetTxSize(),
588 (*ancestor_it)->GetSigChecks(),
589 (*ancestor_it)->GetFee());
591 finalizedTxIds.push_back((*ancestor_it)->GetTx().GetId());
602 const TxId &txid = tx->GetId();
608 return !m_finalizedTxsFitter.isBelowBlockMinFeeRate(
609 entry->GetModifiedFeeRate()) &&
610 m_finalizedTxsFitter.testTxFits(entry->GetTxSize(),
611 entry->GetSigChecks());
619 return m_conflicting && m_conflicting->HaveTx(txid));
624 indexed_transaction_set::const_iterator i = mapTx.find(txid);
625 if (i == mapTx.end()) {
629 return (*i)->GetSharedTx();
634 indexed_transaction_set::const_iterator i = mapTx.find(txid);
635 if (i == mapTx.end()) {
656 Amount &delta = mapDeltas[txid];
658 txiter it = mapTx.find(txid);
659 if (it != mapTx.end()) {
661 e->UpdateFeeDelta(delta);
672 std::map<TxId, Amount>::const_iterator pos = mapDeltas.find(txid);
673 if (pos == mapDeltas.end()) {
677 nFeeDelta += pos->second;
682 mapDeltas.erase(txid);
686 const auto it = mapNextTx.find(prevout);
687 return it == mapNextTx.end() ? nullptr : it->second;
691 auto it = mapTx.find(txid);
692 if (it != mapTx.end()) {
701 for (
const auto &txid : txids) {
711 for (
const CTxIn &in : tx.vin) {
712 if (
exists(in.prevout.GetTxId())) {
738 if (outpoint.GetN() < ptx->vout.size()) {
749 for (uint32_t n = 0; n < tx->vout.size(); ++n) {
765 12 *
sizeof(
void *)) *
774 if (m_unbroadcast_txids.erase(txid)) {
778 (unchecked ?
" before confirmation that txn was sent out" :
""));
789 for (
txiter it : stageRevTopo) {
796 indexed_transaction_set::index<entry_time>::type::iterator it =
799 size_t skippedFinalizedTxs{0};
800 while (it != mapTx.get<
entry_time>().end() && (*it)->GetTime() < time) {
803 ++skippedFinalizedTxs;
805 toremove.insert(mapTx.project<0>(it));
811 if (skippedFinalizedTxs > 0) {
813 skippedFinalizedTxs);
817 for (
txiter removeit : toremove) {
831 "Expired %i transactions from the memory pool\n", expired);
834 std::vector<COutPoint> vNoSpendsRemaining;
836 for (
const COutPoint &removed : vNoSpendsRemaining) {
844 if (add && (*entry)->GetMemPoolChildren().insert(*child).second) {
846 }
else if (!add && (*entry)->GetMemPoolChildren().erase(*child)) {
854 if (add && (*entry)->GetMemPoolParents().insert(*parent).second) {
856 }
else if (!add && (*entry)->GetMemPoolParents().erase(*parent)) {
863 if (!blockSinceLastRollingFeeBump || rollingMinimumFeeRate == 0) {
868 if (time > lastRollingFeeUpdate + 10) {
876 rollingMinimumFeeRate =
877 rollingMinimumFeeRate /
878 pow(2.0, (time - lastRollingFeeUpdate) / halflife);
879 lastRollingFeeUpdate = time;
888 blockSinceLastRollingFeeBump =
false;
893 std::vector<COutPoint> *pvNoSpendsRemaining) {
896 unsigned nTxnRemoved = 0;
897 size_t finalizedTxsSkipped = 0;
902 auto rit = by_modified_feerate.rbegin();
906 ++finalizedTxsSkipped;
908 if (rit == by_modified_feerate.rend()) {
920 if (rit == by_modified_feerate.rend()) {
923 auto it = rit.base();
931 CFeeRate removed = (*it)->GetModifiedFeeRate();
935 maxFeeRateRemoved = std::max(maxFeeRateRemoved, removed);
939 nTxnRemoved += stage.size();
941 if (pvNoSpendsRemaining) {
942 for (
const txiter &iter : stage) {
943 for (
const CTxIn &txin : (*iter)->GetTx().vin) {
944 if (!
exists(txin.prevout.GetTxId())) {
945 pvNoSpendsRemaining->push_back(txin.prevout);
956 "Removed %u txn, rolling minimum fee bumped to %s\n",
957 nTxnRemoved, maxFeeRateRemoved.
ToString());
960 if (finalizedTxsSkipped > 0) {
962 "Not evicting %u finalized txn for low fee\n",
963 finalizedTxsSkipped);
974 m_load_tried = load_tried;
static constexpr Amount SATOSHI
#define Assume(val)
Assume is the identity function.
CCoinsView backed by another CCoinsView.
CCoinsView that adds a memory cache for transactions to another CCoinsView.
void Uncache(const COutPoint &outpoint)
Removes the UTXO with the given outpoint from the cache, if it is not modified.
Abstract view on the open txout dataset.
virtual bool GetCoin(const COutPoint &outpoint, Coin &coin) const
Retrieve the Coin (unspent transaction output) for a given outpoint.
bool GetCoin(const COutPoint &outpoint, Coin &coin) const override
GetCoin, returning whether it exists and is not spent.
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.
CCoinsViewMemPool(CCoinsView *baseIn, const CTxMemPool &mempoolIn)
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...
void PackageAddTransaction(const CTransactionRef &tx)
Add the coins created by this transaction.
const CTxMemPool & mempool
Fee rate in satoshis per kilobyte: Amount / kB.
std::string ToString() const
Amount GetFeePerK() const
Return the fee in satoshis for a size of 1000 bytes.
void TransactionRemovedFromMempool(const CTransactionRef &, MemPoolRemovalReason, uint64_t mempool_sequence)
CTxMemPoolEntry stores data about the corresponding transaction, as well as data about all in-mempool...
std::set< std::reference_wrapper< const CTxMemPoolEntryRef >, CompareIteratorById > Children
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 ...
void removeConflicts(const CTransaction &tx) EXCLUSIVE_LOCKS_REQUIRED(cs)
CFeeRate estimateFee() const
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
void RemoveUnbroadcastTx(const TxId &txid, const bool unchecked=false)
Removes a transaction from the unbroadcast set.
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...
void updateFeeForBlock() EXCLUSIVE_LOCKS_REQUIRED(cs)
Called when a block is connected.
CFeeRate GetMinFee() const
The minimum fee to get into the mempool, which may itself not be enough for larger-sized transactions...
RecursiveMutex cs
This mutex needs to be locked when accessing mapTx or other members that are guarded by it.
void trackPackageRemoved(const CFeeRate &rate) EXCLUSIVE_LOCKS_REQUIRED(cs)
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.
const int m_check_ratio
Value n means that 1 times in n we check.
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
void AddTransactionsUpdated(unsigned int n)
void UpdateChildrenForRemoval(txiter entry) EXCLUSIVE_LOCKS_REQUIRED(cs)
Sever link between specified transaction and direct children.
bool CompareTopologically(const TxId &txida, const TxId &txidb) const
TxMempoolInfo info(const TxId &txid) const
const int64_t m_max_size_bytes
void getAllTxIds(std::vector< TxId > &vtxid) const
std::atomic< uint32_t > nTransactionsUpdated
Used by getblocktemplate to trigger CreateNewBlock() invocation.
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.
size_t DynamicMemoryUsage() const
std::vector< TxMempoolInfo > infoAll() const
void LimitSize(CCoinsViewCache &coins_cache) EXCLUSIVE_LOCKS_REQUIRED(cs
Reduce the size of the mempool by expiring and then trimming the mempool.
void UpdateParent(txiter entry, txiter parent, bool add) EXCLUSIVE_LOCKS_REQUIRED(cs)
bool setAvalancheFinalized(const CTxMemPoolEntryRef &tx, std::vector< TxId > &finalizedTxIds) 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 ...
int Expire(std::chrono::seconds time) EXCLUSIVE_LOCKS_REQUIRED(cs)
Expire all transaction (and their dependencies) in the mempool older than time.
bool isWorthPolling(const CTransactionRef &tx) const EXCLUSIVE_LOCKS_REQUIRED(cs
std::set< txiter, CompareIteratorByRevEntryId > setRevTopoEntries
bool exists(const TxId &txid) const
static const int ROLLING_FEE_HALFLIFE
CTransactionRef get(const TxId &txid) const
bool isAvalancheFinalized(const TxId &txid) const EXCLUSIVE_LOCKS_REQUIRED(cs)
const CFeeRate m_min_relay_feerate
void PrioritiseTransaction(const TxId &txid, const Amount nFeeDelta)
Affect CreateNewBlock prioritisation of transactions.
indexed_transaction_set::nth_index< 0 >::type::const_iterator txiter
uint64_t GetAndIncrementSequence() const EXCLUSIVE_LOCKS_REQUIRED(cs)
Guards this internal counter for external reporting.
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...
RadixTree< CTxMemPoolEntry, MemPoolEntryRadixTreeAdapter > finalizedTxs
void check(const CCoinsViewCache &active_coins_tip, int64_t spendheight) const EXCLUSIVE_LOCKS_REQUIRED(void cs_main
bool CalculateMemPoolAncestors(const CTxMemPoolEntryRef &entry, setEntries &setAncestors, bool fSearchForParents=true) const EXCLUSIVE_LOCKS_REQUIRED(cs)
Try to calculate all in-mempool ancestors of entry.
void removeForFinalizedBlock(const std::vector< CTransactionRef > &vtx) EXCLUSIVE_LOCKS_REQUIRED(cs)
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.
CTxMemPool(const Config &config, const Options &opts)
Create a new CTxMemPool.
void UpdateParentsOf(bool add, txiter it) EXCLUSIVE_LOCKS_REQUIRED(cs)
Update parents of it to add/remove it as a child transaction.
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...
std::optional< txiter > GetIter(const TxId &txid) const EXCLUSIVE_LOCKS_REQUIRED(cs)
Returns an iterator to the given txid, if found.
bool isSpent(const COutPoint &outpoint) const
unsigned int GetTransactionsUpdated() const
void _clear() EXCLUSIVE_LOCKS_REQUIRED(cs)
T * get()
Get allows to access the undelying pointer.
std::string ToString() const
std::string GetHex() const
void AddCoins(CCoinsViewCache &cache, const CTransaction &tx, int nHeight, bool check_for_overwrite)
Utility function to add all of a transaction's outputs to a cache.
#define LogPrint(category,...)
std::string FormatMoney(const Amount amt)
Do not use these functions to represent or parse monetary amounts to or from JSON but use AmountFromV...
bool CheckTxInputs(const CTransaction &tx, TxValidationState &state, const CCoinsViewCache &inputs, int nSpendHeight, Amount &txfee)
Check whether all inputs of this transaction are valid (no double spends and amounts).
static size_t DynamicUsage(const int8_t &v)
Dynamic memory usage for built-in types is zero.
static size_t IncrementalDynamicUsage(const std::set< X, Y > &s)
static size_t MallocUsage(size_t alloc)
Compute the total memory used by allocating alloc bytes.
Implement std::hash so RCUPtr can be used as a key for maps or sets.
static constexpr CFeeRate MEMPOOL_FULL_FEE_INCREMENT(1000 *SATOSHI)
Default for -incrementalrelayfee, which sets the minimum feerate increase for mempool limiting or BIP...
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...
static constexpr Amount zero() noexcept
RCUPtr< T > remove(const KeyType &key)
Remove an element from the tree.
bool insert(const RCUPtr< T > &value)
Insert a value into the tree.
A TxId is the identifier of a transaction.
Information about a mempool transaction.
Options struct containing options for constructing a CTxMemPool.
#define AssertLockNotHeld(cs)
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
int64_t GetTime()
DEPRECATED Use either ClockType::now() or Now<TimePointType>() if a cast is needed.
bilingual_str _(const char *psz)
Translation function.
std::string RemovalReasonToString(const MemPoolRemovalReason &r) noexcept
static TxMempoolInfo GetInfo(CTxMemPool::indexed_transaction_set::const_iterator it)
MemPoolRemovalReason
Reason why a transaction was removed from the mempool, this is passed to the notification signal.
@ 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....
CMainSignals & GetMainSignals()