Dash Core  0.12.2.1
P2P Digital Currency
CTxMemPoolEntry Class Reference

#include <txmempool.h>

Public Member Functions

 CTxMemPoolEntry (const CTransaction &_tx, const CAmount &_nFee, int64_t _nTime, double _entryPriority, unsigned int _entryHeight, bool poolHasNoInputsOf, CAmount _inChainInputValue, bool spendsCoinbase, unsigned int nSigOps, LockPoints lp)
 ... and total fees (all including us) More...
 
 CTxMemPoolEntry (const CTxMemPoolEntry &other)
 
const CTransactionGetTx () const
 
double GetPriority (unsigned int currentHeight) const
 
const CAmountGetFee () const
 
size_t GetTxSize () const
 
int64_t GetTime () const
 
unsigned int GetHeight () const
 
bool WasClearAtEntry () const
 
unsigned int GetSigOpCount () const
 
int64_t GetModifiedFee () const
 
size_t DynamicMemoryUsage () const
 
const LockPointsGetLockPoints () const
 
void UpdateState (int64_t modifySize, CAmount modifyFee, int64_t modifyCount)
 
void UpdateFeeDelta (int64_t feeDelta)
 
void UpdateLockPoints (const LockPoints &lp)
 
void SetDirty ()
 
bool IsDirty () const
 
uint64_t GetCountWithDescendants () const
 
uint64_t GetSizeWithDescendants () const
 
CAmount GetModFeesWithDescendants () const
 
bool GetSpendsCoinbase () const
 

Private Attributes

CTransaction tx
 
CAmount nFee
 
size_t nTxSize
 Cached to avoid expensive parent-transaction lookups. More...
 
size_t nModSize
 ... and avoid recomputing tx size More...
 
size_t nUsageSize
 ... and modified size for priority More...
 
int64_t nTime
 ... and total memory usage More...
 
double entryPriority
 Local time when entering the mempool. More...
 
unsigned int entryHeight
 Priority when entering the mempool. More...
 
bool hadNoDependencies
 Chain height when entering the mempool. More...
 
CAmount inChainInputValue
 Not dependent on any other txs when it entered the mempool. More...
 
bool spendsCoinbase
 Sum of all txin values that are already in blockchain. More...
 
unsigned int sigOpCount
 keep track of transactions that spend a coinbase More...
 
int64_t feeDelta
 Legacy sig ops plus P2SH sig op count. More...
 
LockPoints lockPoints
 Used for determining the priority of the transaction for mining in a block. More...
 
uint64_t nCountWithDescendants
 Track the height and time at which tx was final. More...
 
uint64_t nSizeWithDescendants
 number of descendant transactions More...
 
CAmount nModFeesWithDescendants
 ... and size More...
 

Detailed Description

CTxMemPoolEntry stores data about the correponding 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 (nCountWithDescendants, nSizeWithDescendants, and nModFeesWithDescendants) for all ancestors of the newly added transaction.

If updating the descendant state is skipped, we can mark the entry as "dirty", and set nSizeWithDescendants/nModFeesWithDescendants to equal nTxSize/ nFee+feeDelta. (This can potentially happen during a reorg, where we limit the amount of work we're willing to do to avoid consuming too much CPU.)

Definition at line 76 of file txmempool.h.

Constructor & Destructor Documentation

◆ CTxMemPoolEntry() [1/2]

CTxMemPoolEntry::CTxMemPoolEntry ( const CTransaction _tx,
const CAmount _nFee,
int64_t  _nTime,
double  _entryPriority,
unsigned int  _entryHeight,
bool  poolHasNoInputsOf,
CAmount  _inChainInputValue,
bool  spendsCoinbase,
unsigned int  nSigOps,
LockPoints  lp 
)

... and total fees (all including us)

Definition at line 23 of file txmempool.cpp.

◆ CTxMemPoolEntry() [2/2]

CTxMemPoolEntry::CTxMemPoolEntry ( const CTxMemPoolEntry other)

Definition at line 44 of file txmempool.cpp.

Member Function Documentation

◆ DynamicMemoryUsage()

size_t CTxMemPoolEntry::DynamicMemoryUsage ( ) const
inline

Definition at line 123 of file txmempool.h.

Referenced by CTxMemPool::addUnchecked().

◆ GetCountWithDescendants()

uint64_t CTxMemPoolEntry::GetCountWithDescendants ( ) const
inline

Definition at line 141 of file txmempool.h.

Referenced by mempoolToJSON().

◆ GetFee()

const CAmount& CTxMemPoolEntry::GetFee ( ) const
inline

◆ GetHeight()

unsigned int CTxMemPoolEntry::GetHeight ( ) const
inline

◆ GetLockPoints()

const LockPoints& CTxMemPoolEntry::GetLockPoints ( ) const
inline

Definition at line 124 of file txmempool.h.

◆ GetModFeesWithDescendants()

CAmount CTxMemPoolEntry::GetModFeesWithDescendants ( ) const
inline

◆ GetModifiedFee()

◆ GetPriority()

double CTxMemPoolEntry::GetPriority ( unsigned int  currentHeight) const

Fast calculation of lower bound of current priority as update from entry priority. Only inputs that were originally in-chain will age.

Definition at line 50 of file txmempool.cpp.

Referenced by mempoolToJSON(), CBlockPolicyEstimator::processBlockTx(), and CBlockPolicyEstimator::processTransaction().

◆ GetSigOpCount()

unsigned int CTxMemPoolEntry::GetSigOpCount ( ) const
inline

Definition at line 121 of file txmempool.h.

◆ GetSizeWithDescendants()

uint64_t CTxMemPoolEntry::GetSizeWithDescendants ( ) const
inline

◆ GetSpendsCoinbase()

bool CTxMemPoolEntry::GetSpendsCoinbase ( ) const
inline

Definition at line 145 of file txmempool.h.

◆ GetTime()

int64_t CTxMemPoolEntry::GetTime ( ) const
inline

◆ GetTx()

◆ GetTxSize()

◆ IsDirty()

bool CTxMemPoolEntry::IsDirty ( ) const
inline

Definition at line 139 of file txmempool.h.

Referenced by UpdateState().

◆ SetDirty()

void CTxMemPoolEntry::SetDirty ( )

We can set the entry to be dirty if doing the full calculation of in- mempool descendants will be too expensive, which can potentially happen when re-adding transactions from a block back to the mempool.

Definition at line 310 of file txmempool.cpp.

Referenced by set_dirty::operator()().

◆ UpdateFeeDelta()

void CTxMemPoolEntry::UpdateFeeDelta ( int64_t  feeDelta)

Definition at line 59 of file txmempool.cpp.

Referenced by update_fee_delta::operator()().

◆ UpdateLockPoints()

void CTxMemPoolEntry::UpdateLockPoints ( const LockPoints lp)

Definition at line 65 of file txmempool.cpp.

Referenced by update_lock_points::operator()().

◆ UpdateState()

void CTxMemPoolEntry::UpdateState ( int64_t  modifySize,
CAmount  modifyFee,
int64_t  modifyCount 
)

Definition at line 317 of file txmempool.cpp.

Referenced by update_descendant_state::operator()().

◆ WasClearAtEntry()

bool CTxMemPoolEntry::WasClearAtEntry ( ) const
inline

Member Data Documentation

◆ entryHeight

unsigned int CTxMemPoolEntry::entryHeight
private

Priority when entering the mempool.

Definition at line 86 of file txmempool.h.

Referenced by GetHeight(), and GetPriority().

◆ entryPriority

double CTxMemPoolEntry::entryPriority
private

Local time when entering the mempool.

Definition at line 85 of file txmempool.h.

Referenced by GetPriority().

◆ feeDelta

int64_t CTxMemPoolEntry::feeDelta
private

Legacy sig ops plus P2SH sig op count.

Definition at line 91 of file txmempool.h.

Referenced by CTxMemPoolEntry(), GetModifiedFee(), and UpdateFeeDelta().

◆ hadNoDependencies

bool CTxMemPoolEntry::hadNoDependencies
private

Chain height when entering the mempool.

Definition at line 87 of file txmempool.h.

Referenced by WasClearAtEntry().

◆ inChainInputValue

CAmount CTxMemPoolEntry::inChainInputValue
private

Not dependent on any other txs when it entered the mempool.

Definition at line 88 of file txmempool.h.

Referenced by CTxMemPoolEntry(), and GetPriority().

◆ lockPoints

LockPoints CTxMemPoolEntry::lockPoints
private

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

Definition at line 92 of file txmempool.h.

Referenced by GetLockPoints(), and UpdateLockPoints().

◆ nCountWithDescendants

uint64_t CTxMemPoolEntry::nCountWithDescendants
private

Track the height and time at which tx was final.

Definition at line 99 of file txmempool.h.

Referenced by CTxMemPoolEntry(), GetCountWithDescendants(), IsDirty(), SetDirty(), and UpdateState().

◆ nFee

CAmount CTxMemPoolEntry::nFee
private

Definition at line 80 of file txmempool.h.

Referenced by CTxMemPoolEntry(), GetFee(), and GetModifiedFee().

◆ nModFeesWithDescendants

CAmount CTxMemPoolEntry::nModFeesWithDescendants
private

... and size

Definition at line 101 of file txmempool.h.

Referenced by CTxMemPoolEntry(), GetModFeesWithDescendants(), SetDirty(), UpdateFeeDelta(), and UpdateState().

◆ nModSize

size_t CTxMemPoolEntry::nModSize
private

... and avoid recomputing tx size

Definition at line 82 of file txmempool.h.

Referenced by CTxMemPoolEntry(), and GetPriority().

◆ nSizeWithDescendants

uint64_t CTxMemPoolEntry::nSizeWithDescendants
private

number of descendant transactions

Definition at line 100 of file txmempool.h.

Referenced by CTxMemPoolEntry(), GetSizeWithDescendants(), SetDirty(), and UpdateState().

◆ nTime

int64_t CTxMemPoolEntry::nTime
private

... and total memory usage

Definition at line 84 of file txmempool.h.

Referenced by GetTime().

◆ nTxSize

size_t CTxMemPoolEntry::nTxSize
private

Cached to avoid expensive parent-transaction lookups.

Definition at line 81 of file txmempool.h.

Referenced by CTxMemPoolEntry(), GetTxSize(), and SetDirty().

◆ nUsageSize

size_t CTxMemPoolEntry::nUsageSize
private

... and modified size for priority

Definition at line 83 of file txmempool.h.

Referenced by CTxMemPoolEntry(), and DynamicMemoryUsage().

◆ sigOpCount

unsigned int CTxMemPoolEntry::sigOpCount
private

keep track of transactions that spend a coinbase

Definition at line 90 of file txmempool.h.

Referenced by GetSigOpCount().

◆ spendsCoinbase

bool CTxMemPoolEntry::spendsCoinbase
private

Sum of all txin values that are already in blockchain.

Definition at line 89 of file txmempool.h.

Referenced by GetSpendsCoinbase().

◆ tx

CTransaction CTxMemPoolEntry::tx
private

Definition at line 79 of file txmempool.h.

Referenced by CTxMemPoolEntry(), and GetTx().


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