Bitcoin Core 28.99.0
P2P Digital Currency
Classes | Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
CTxMemPoolEntry Class Reference

CTxMemPoolEntry stores data about the corresponding transaction, as well as data about all in-mempool transactions that depend on the transaction ("descendant" transactions). More...

#include <mempool_entry.h>

Collaboration diagram for CTxMemPoolEntry:
[legend]

Classes

struct  ExplicitCopyTag
 

Public Types

typedef std::reference_wrapper< const CTxMemPoolEntryCTxMemPoolEntryRef
 
typedef std::set< CTxMemPoolEntryRef, CompareIteratorByHashParents
 
typedef std::set< CTxMemPoolEntryRef, CompareIteratorByHashChildren
 

Public Member Functions

 CTxMemPoolEntry (const CTransactionRef &tx, CAmount fee, int64_t time, unsigned int entry_height, uint64_t entry_sequence, bool spends_coinbase, int64_t sigops_cost, LockPoints lp)
 
 CTxMemPoolEntry (ExplicitCopyTag, const CTxMemPoolEntry &entry)
 
CTxMemPoolEntryoperator= (const CTxMemPoolEntry &)=delete
 
 CTxMemPoolEntry (CTxMemPoolEntry &&)=delete
 
CTxMemPoolEntryoperator= (CTxMemPoolEntry &&)=delete
 
const CTransactionGetTx () const
 
CTransactionRef GetSharedTx () const
 
const CAmountGetFee () const
 
int32_t GetTxSize () const
 
int32_t GetTxWeight () const
 
std::chrono::seconds GetTime () const
 
unsigned int GetHeight () const
 
uint64_t GetSequence () const
 
int64_t GetSigOpCost () const
 
CAmount GetModifiedFee () const
 
size_t DynamicMemoryUsage () const
 
const LockPointsGetLockPoints () const
 
void UpdateDescendantState (int32_t modifySize, CAmount modifyFee, int64_t modifyCount)
 
void UpdateAncestorState (int32_t modifySize, CAmount modifyFee, int64_t modifyCount, int64_t modifySigOps)
 
void UpdateModifiedFee (CAmount fee_diff)
 
void UpdateLockPoints (const LockPoints &lp) const
 
uint64_t GetCountWithDescendants () const
 
int64_t GetSizeWithDescendants () const
 
CAmount GetModFeesWithDescendants () const
 
bool GetSpendsCoinbase () const
 
uint64_t GetCountWithAncestors () const
 
int64_t GetSizeWithAncestors () const
 
CAmount GetModFeesWithAncestors () const
 
int64_t GetSigOpCostWithAncestors () const
 
const ParentsGetMemPoolParentsConst () const
 
const ChildrenGetMemPoolChildrenConst () const
 
ParentsGetMemPoolParents () const
 
ChildrenGetMemPoolChildren () const
 

Public Attributes

size_t idx_randomized
 Index in mempool's txns_randomized. More...
 
Epoch::Marker m_epoch_marker
 epoch when last touched, useful for graph algorithms More...
 

Static Public Attributes

static constexpr ExplicitCopyTag ExplicitCopy {}
 

Private Member Functions

 CTxMemPoolEntry (const CTxMemPoolEntry &)=default
 

Private Attributes

const CTransactionRef tx
 
Parents m_parents
 
Children m_children
 
const CAmount nFee
 Cached to avoid expensive parent-transaction lookups. More...
 
const int32_t nTxWeight
 ... and avoid recomputing tx weight (also used for GetTxSize()) More...
 
const size_t nUsageSize
 ... and total memory usage More...
 
const int64_t nTime
 Local time when entering the mempool. More...
 
const uint64_t entry_sequence
 Sequence number used to determine whether this transaction is too recent for relay. More...
 
const unsigned int entryHeight
 Chain height when entering the mempool. More...
 
const bool spendsCoinbase
 keep track of transactions that spend a coinbase More...
 
const int64_t sigOpCost
 Total sigop cost. More...
 
CAmount m_modified_fee
 Used for determining the priority of the transaction for mining in a block. More...
 
LockPoints lockPoints
 Track the height and time at which tx was final. More...
 
int64_t m_count_with_descendants {1}
 number of descendant transactions More...
 
int64_t nSizeWithDescendants
 ... and size More...
 
CAmount nModFeesWithDescendants
 ... and total fees (all including us) More...
 
int64_t m_count_with_ancestors {1}
 
int64_t nSizeWithAncestors
 
CAmount nModFeesWithAncestors
 
int64_t nSigOpCostWithAncestors
 

Detailed Description

CTxMemPoolEntry stores data about the corresponding transaction, as well as data about all in-mempool transactions that depend on the transaction ("descendant" transactions).

When a new entry is added to the mempool, we update the descendant state (m_count_with_descendants, nSizeWithDescendants, and nModFeesWithDescendants) for all ancestors of the newly added transaction.

Definition at line 65 of file mempool_entry.h.

Member Typedef Documentation

◆ Children

Definition at line 71 of file mempool_entry.h.

◆ CTxMemPoolEntryRef

typedef std::reference_wrapper<const CTxMemPoolEntry> CTxMemPoolEntry::CTxMemPoolEntryRef

Definition at line 68 of file mempool_entry.h.

◆ Parents

Definition at line 70 of file mempool_entry.h.

Constructor & Destructor Documentation

◆ CTxMemPoolEntry() [1/4]

CTxMemPoolEntry::CTxMemPoolEntry ( const CTxMemPoolEntry )
privatedefault

◆ CTxMemPoolEntry() [2/4]

CTxMemPoolEntry::CTxMemPoolEntry ( const CTransactionRef tx,
CAmount  fee,
int64_t  time,
unsigned int  entry_height,
uint64_t  entry_sequence,
bool  spends_coinbase,
int64_t  sigops_cost,
LockPoints  lp 
)
inline

Definition at line 109 of file mempool_entry.h.

◆ CTxMemPoolEntry() [3/4]

CTxMemPoolEntry::CTxMemPoolEntry ( ExplicitCopyTag  ,
const CTxMemPoolEntry entry 
)
inline

Definition at line 130 of file mempool_entry.h.

◆ CTxMemPoolEntry() [4/4]

CTxMemPoolEntry::CTxMemPoolEntry ( CTxMemPoolEntry &&  )
delete

Member Function Documentation

◆ DynamicMemoryUsage()

size_t CTxMemPoolEntry::DynamicMemoryUsage ( ) const
inline

Definition at line 150 of file mempool_entry.h.

Here is the caller graph for this function:

◆ GetCountWithAncestors()

uint64_t CTxMemPoolEntry::GetCountWithAncestors ( ) const
inline

Definition at line 177 of file mempool_entry.h.

◆ GetCountWithDescendants()

uint64_t CTxMemPoolEntry::GetCountWithDescendants ( ) const
inline

Definition at line 171 of file mempool_entry.h.

◆ GetFee()

const CAmount & CTxMemPoolEntry::GetFee ( ) const
inline

Definition at line 139 of file mempool_entry.h.

Here is the caller graph for this function:

◆ GetHeight()

unsigned int CTxMemPoolEntry::GetHeight ( ) const
inline

Definition at line 146 of file mempool_entry.h.

Here is the caller graph for this function:

◆ GetLockPoints()

const LockPoints & CTxMemPoolEntry::GetLockPoints ( ) const
inline

Definition at line 151 of file mempool_entry.h.

Here is the caller graph for this function:

◆ GetMemPoolChildren()

Children & CTxMemPoolEntry::GetMemPoolChildren ( ) const
inline

Definition at line 185 of file mempool_entry.h.

◆ GetMemPoolChildrenConst()

const Children & CTxMemPoolEntry::GetMemPoolChildrenConst ( ) const
inline

Definition at line 183 of file mempool_entry.h.

Here is the caller graph for this function:

◆ GetMemPoolParents()

Parents & CTxMemPoolEntry::GetMemPoolParents ( ) const
inline

Definition at line 184 of file mempool_entry.h.

◆ GetMemPoolParentsConst()

const Parents & CTxMemPoolEntry::GetMemPoolParentsConst ( ) const
inline

Definition at line 182 of file mempool_entry.h.

Here is the caller graph for this function:

◆ GetModFeesWithAncestors()

CAmount CTxMemPoolEntry::GetModFeesWithAncestors ( ) const
inline

Definition at line 179 of file mempool_entry.h.

◆ GetModFeesWithDescendants()

CAmount CTxMemPoolEntry::GetModFeesWithDescendants ( ) const
inline

Definition at line 173 of file mempool_entry.h.

Here is the caller graph for this function:

◆ GetModifiedFee()

CAmount CTxMemPoolEntry::GetModifiedFee ( ) const
inline

Definition at line 149 of file mempool_entry.h.

Here is the caller graph for this function:

◆ GetSequence()

uint64_t CTxMemPoolEntry::GetSequence ( ) const
inline

Definition at line 147 of file mempool_entry.h.

Here is the caller graph for this function:

◆ GetSharedTx()

CTransactionRef CTxMemPoolEntry::GetSharedTx ( ) const
inline

Definition at line 138 of file mempool_entry.h.

Here is the caller graph for this function:

◆ GetSigOpCost()

int64_t CTxMemPoolEntry::GetSigOpCost ( ) const
inline

Definition at line 148 of file mempool_entry.h.

Here is the caller graph for this function:

◆ GetSigOpCostWithAncestors()

int64_t CTxMemPoolEntry::GetSigOpCostWithAncestors ( ) const
inline

Definition at line 180 of file mempool_entry.h.

◆ GetSizeWithAncestors()

int64_t CTxMemPoolEntry::GetSizeWithAncestors ( ) const
inline

Definition at line 178 of file mempool_entry.h.

◆ GetSizeWithDescendants()

int64_t CTxMemPoolEntry::GetSizeWithDescendants ( ) const
inline

Definition at line 172 of file mempool_entry.h.

Here is the caller graph for this function:

◆ GetSpendsCoinbase()

bool CTxMemPoolEntry::GetSpendsCoinbase ( ) const
inline

Definition at line 175 of file mempool_entry.h.

Here is the caller graph for this function:

◆ GetTime()

std::chrono::seconds CTxMemPoolEntry::GetTime ( ) const
inline

Definition at line 145 of file mempool_entry.h.

Here is the caller graph for this function:

◆ GetTx()

const CTransaction & CTxMemPoolEntry::GetTx ( ) const
inline

Definition at line 137 of file mempool_entry.h.

Here is the caller graph for this function:

◆ GetTxSize()

int32_t CTxMemPoolEntry::GetTxSize ( ) const
inline

Definition at line 140 of file mempool_entry.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTxWeight()

int32_t CTxMemPoolEntry::GetTxWeight ( ) const
inline

Definition at line 144 of file mempool_entry.h.

◆ operator=() [1/2]

CTxMemPoolEntry & CTxMemPoolEntry::operator= ( const CTxMemPoolEntry )
delete

◆ operator=() [2/2]

CTxMemPoolEntry & CTxMemPoolEntry::operator= ( CTxMemPoolEntry &&  )
delete

◆ UpdateAncestorState()

void CTxMemPoolEntry::UpdateAncestorState ( int32_t  modifySize,
CAmount  modifyFee,
int64_t  modifyCount,
int64_t  modifySigOps 
)

Definition at line 392 of file txmempool.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateDescendantState()

void CTxMemPoolEntry::UpdateDescendantState ( int32_t  modifySize,
CAmount  modifyFee,
int64_t  modifyCount 
)

Definition at line 383 of file txmempool.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateLockPoints()

void CTxMemPoolEntry::UpdateLockPoints ( const LockPoints lp) const
inline

Definition at line 166 of file mempool_entry.h.

◆ UpdateModifiedFee()

void CTxMemPoolEntry::UpdateModifiedFee ( CAmount  fee_diff)
inline

Definition at line 158 of file mempool_entry.h.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ entry_sequence

const uint64_t CTxMemPoolEntry::entry_sequence
private

Sequence number used to determine whether this transaction is too recent for relay.

Definition at line 86 of file mempool_entry.h.

◆ entryHeight

const unsigned int CTxMemPoolEntry::entryHeight
private

Chain height when entering the mempool.

Definition at line 87 of file mempool_entry.h.

◆ ExplicitCopy

constexpr ExplicitCopyTag CTxMemPoolEntry::ExplicitCopy {}
staticconstexpr

Definition at line 135 of file mempool_entry.h.

◆ idx_randomized

size_t CTxMemPoolEntry::idx_randomized
mutable

Index in mempool's txns_randomized.

Definition at line 187 of file mempool_entry.h.

◆ lockPoints

LockPoints CTxMemPoolEntry::lockPoints
mutableprivate

Track the height and time at which tx was final.

Definition at line 91 of file mempool_entry.h.

◆ m_children

Children CTxMemPoolEntry::m_children
mutableprivate

Definition at line 81 of file mempool_entry.h.

◆ m_count_with_ancestors

int64_t CTxMemPoolEntry::m_count_with_ancestors {1}
private

Definition at line 102 of file mempool_entry.h.

◆ m_count_with_descendants

int64_t CTxMemPoolEntry::m_count_with_descendants {1}
private

number of descendant transactions

Definition at line 96 of file mempool_entry.h.

◆ m_epoch_marker

Epoch::Marker CTxMemPoolEntry::m_epoch_marker
mutable

epoch when last touched, useful for graph algorithms

Definition at line 188 of file mempool_entry.h.

◆ m_modified_fee

CAmount CTxMemPoolEntry::m_modified_fee
private

Used for determining the priority of the transaction for mining in a block.

Definition at line 90 of file mempool_entry.h.

◆ m_parents

Parents CTxMemPoolEntry::m_parents
mutableprivate

Definition at line 80 of file mempool_entry.h.

◆ nFee

const CAmount CTxMemPoolEntry::nFee
private

Cached to avoid expensive parent-transaction lookups.

Definition at line 82 of file mempool_entry.h.

◆ nModFeesWithAncestors

CAmount CTxMemPoolEntry::nModFeesWithAncestors
private

Definition at line 105 of file mempool_entry.h.

◆ nModFeesWithDescendants

CAmount CTxMemPoolEntry::nModFeesWithDescendants
private

... and total fees (all including us)

Definition at line 99 of file mempool_entry.h.

◆ nSigOpCostWithAncestors

int64_t CTxMemPoolEntry::nSigOpCostWithAncestors
private

Definition at line 106 of file mempool_entry.h.

◆ nSizeWithAncestors

int64_t CTxMemPoolEntry::nSizeWithAncestors
private

Definition at line 104 of file mempool_entry.h.

◆ nSizeWithDescendants

int64_t CTxMemPoolEntry::nSizeWithDescendants
private

... and size

Definition at line 98 of file mempool_entry.h.

◆ nTime

const int64_t CTxMemPoolEntry::nTime
private

Local time when entering the mempool.

Definition at line 85 of file mempool_entry.h.

◆ nTxWeight

const int32_t CTxMemPoolEntry::nTxWeight
private

... and avoid recomputing tx weight (also used for GetTxSize())

Definition at line 83 of file mempool_entry.h.

◆ nUsageSize

const size_t CTxMemPoolEntry::nUsageSize
private

... and total memory usage

Definition at line 84 of file mempool_entry.h.

◆ sigOpCost

const int64_t CTxMemPoolEntry::sigOpCost
private

Total sigop cost.

Definition at line 89 of file mempool_entry.h.

◆ spendsCoinbase

const bool CTxMemPoolEntry::spendsCoinbase
private

keep track of transactions that spend a coinbase

Definition at line 88 of file mempool_entry.h.

◆ tx

const CTransactionRef CTxMemPoolEntry::tx
private

Definition at line 79 of file mempool_entry.h.


The documentation for this class was generated from the following files: