PIVX Core  5.6.99
P2P Digital Currency
Public 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 <txmempool.h>

Collaboration diagram for CTxMemPoolEntry:
[legend]

Public Member Functions

 CTxMemPoolEntry (const CTransactionRef &_tx, const CAmount &_nFee, int64_t _nTime, unsigned int _entryHeight, bool _spendsCoinbaseOrCoinstake, unsigned int nSigOps)
 
const CTransactionGetTx () const
 
std::shared_ptr< const CTransactionGetSharedTx () const
 
const CAmountGetFee () const
 
size_t GetTxSize () const
 
int64_t GetTime () const
 
unsigned int GetHeight () const
 
bool HasZerocoins () const
 
bool IsShielded () const
 
unsigned int GetSigOpCount () const
 
int64_t GetModifiedFee () const
 
size_t DynamicMemoryUsage () const
 
void UpdateDescendantState (int64_t modifySize, CAmount modifyFee, int64_t modifyCount)
 
void UpdateAncestorState (int64_t modifySize, CAmount modifyFee, int64_t modifyCount, int modifySigOps)
 
void UpdateFeeDelta (int64_t feeDelta)
 
uint64_t GetCountWithDescendants () const
 
uint64_t GetSizeWithDescendants () const
 
CAmount GetModFeesWithDescendants () const
 
bool GetSpendsCoinbaseOrCoinstake () const
 
uint64_t GetCountWithAncestors () const
 
uint64_t GetSizeWithAncestors () const
 
CAmount GetModFeesWithAncestors () const
 
unsigned int GetSigOpCountWithAncestors () const
 

Private Attributes

CTransactionRef tx
 
CAmount nFee
 
size_t nTxSize
 Cached to avoid expensive parent-transaction lookups. More...
 
size_t nUsageSize
 ... and avoid recomputing tx size More...
 
CFeeRate feeRate
 ... and total memory usage More...
 
bool hasZerocoins {false}
 ... and fee per kB More...
 
bool m_isShielded {false}
 ... and checking if it contains zPIV (mints/spends) More...
 
int64_t nTime
 ... and checking if it contains shielded spends/outputs More...
 
unsigned int entryHeight
 Local time when entering the mempool. More...
 
bool spendsCoinbaseOrCoinstake
 Chain height when entering the mempool. More...
 
unsigned int sigOpCount
 keep track of transactions that spend a coinbase or a coinstake More...
 
int64_t feeDelta
 Legacy sig ops plus P2SH sig op count. More...
 
uint64_t nCountWithDescendants
 Used for determining the priority of the transaction for mining in a block. More...
 
uint64_t nSizeWithDescendants
 number of descendant transactions More...
 
CAmount nModFeesWithDescendants
 ... and size More...
 
uint64_t nCountWithAncestors
 ... and total fees (all including us) More...
 
uint64_t nSizeWithAncestors
 
CAmount nModFeesWithAncestors
 
unsigned int nSigOpCountWithAncestors
 

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 (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 54 of file txmempool.h.

Constructor & Destructor Documentation

◆ CTxMemPoolEntry()

CTxMemPoolEntry::CTxMemPoolEntry ( const CTransactionRef _tx,
const CAmount _nFee,
int64_t  _nTime,
unsigned int  _entryHeight,
bool  _spendsCoinbaseOrCoinstake,
unsigned int  nSigOps 
)

Definition at line 26 of file txmempool.cpp.

Member Function Documentation

◆ DynamicMemoryUsage()

size_t CTxMemPoolEntry::DynamicMemoryUsage ( ) const
inline

Definition at line 100 of file txmempool.h.

Here is the caller graph for this function:

◆ GetCountWithAncestors()

uint64_t CTxMemPoolEntry::GetCountWithAncestors ( ) const
inline

Definition at line 116 of file txmempool.h.

◆ GetCountWithDescendants()

uint64_t CTxMemPoolEntry::GetCountWithDescendants ( ) const
inline

Definition at line 110 of file txmempool.h.

◆ GetFee()

const CAmount& CTxMemPoolEntry::GetFee ( ) const
inline

Definition at line 92 of file txmempool.h.

Here is the caller graph for this function:

◆ GetHeight()

unsigned int CTxMemPoolEntry::GetHeight ( ) const
inline

Definition at line 95 of file txmempool.h.

Here is the caller graph for this function:

◆ GetModFeesWithAncestors()

CAmount CTxMemPoolEntry::GetModFeesWithAncestors ( ) const
inline

Definition at line 118 of file txmempool.h.

Here is the caller graph for this function:

◆ GetModFeesWithDescendants()

CAmount CTxMemPoolEntry::GetModFeesWithDescendants ( ) const
inline

Definition at line 112 of file txmempool.h.

Here is the caller graph for this function:

◆ GetModifiedFee()

int64_t CTxMemPoolEntry::GetModifiedFee ( ) const
inline

Definition at line 99 of file txmempool.h.

Here is the caller graph for this function:

◆ GetSharedTx()

std::shared_ptr<const CTransaction> CTxMemPoolEntry::GetSharedTx ( ) const
inline

Definition at line 91 of file txmempool.h.

Here is the caller graph for this function:

◆ GetSigOpCount()

unsigned int CTxMemPoolEntry::GetSigOpCount ( ) const
inline

Definition at line 98 of file txmempool.h.

◆ GetSigOpCountWithAncestors()

unsigned int CTxMemPoolEntry::GetSigOpCountWithAncestors ( ) const
inline

Definition at line 119 of file txmempool.h.

◆ GetSizeWithAncestors()

uint64_t CTxMemPoolEntry::GetSizeWithAncestors ( ) const
inline

Definition at line 117 of file txmempool.h.

Here is the caller graph for this function:

◆ GetSizeWithDescendants()

uint64_t CTxMemPoolEntry::GetSizeWithDescendants ( ) const
inline

Definition at line 111 of file txmempool.h.

Here is the caller graph for this function:

◆ GetSpendsCoinbaseOrCoinstake()

bool CTxMemPoolEntry::GetSpendsCoinbaseOrCoinstake ( ) const
inline

Definition at line 114 of file txmempool.h.

◆ GetTime()

int64_t CTxMemPoolEntry::GetTime ( ) const
inline

Definition at line 94 of file txmempool.h.

Here is the caller graph for this function:

◆ GetTx()

const CTransaction& CTxMemPoolEntry::GetTx ( ) const
inline

Definition at line 90 of file txmempool.h.

Here is the caller graph for this function:

◆ GetTxSize()

size_t CTxMemPoolEntry::GetTxSize ( ) const
inline

Definition at line 93 of file txmempool.h.

Here is the caller graph for this function:

◆ HasZerocoins()

bool CTxMemPoolEntry::HasZerocoins ( ) const
inline

Definition at line 96 of file txmempool.h.

Here is the caller graph for this function:

◆ IsShielded()

bool CTxMemPoolEntry::IsShielded ( ) const
inline

Definition at line 97 of file txmempool.h.

Here is the caller graph for this function:

◆ UpdateAncestorState()

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

Definition at line 315 of file txmempool.cpp.

Here is the caller graph for this function:

◆ UpdateDescendantState()

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

Definition at line 306 of file txmempool.cpp.

Here is the caller graph for this function:

◆ UpdateFeeDelta()

void CTxMemPoolEntry::UpdateFeeDelta ( int64_t  feeDelta)

Definition at line 49 of file txmempool.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ entryHeight

unsigned int CTxMemPoolEntry::entryHeight
private

Local time when entering the mempool.

Definition at line 65 of file txmempool.h.

◆ feeDelta

int64_t CTxMemPoolEntry::feeDelta
private

Legacy sig ops plus P2SH sig op count.

Definition at line 68 of file txmempool.h.

◆ feeRate

CFeeRate CTxMemPoolEntry::feeRate
private

... and total memory usage

Definition at line 61 of file txmempool.h.

◆ hasZerocoins

bool CTxMemPoolEntry::hasZerocoins {false}
private

... and fee per kB

Definition at line 62 of file txmempool.h.

◆ m_isShielded

bool CTxMemPoolEntry::m_isShielded {false}
private

... and checking if it contains zPIV (mints/spends)

Definition at line 63 of file txmempool.h.

◆ nCountWithAncestors

uint64_t CTxMemPoolEntry::nCountWithAncestors
private

... and total fees (all including us)

Definition at line 80 of file txmempool.h.

◆ nCountWithDescendants

uint64_t CTxMemPoolEntry::nCountWithDescendants
private

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

Definition at line 75 of file txmempool.h.

◆ nFee

CAmount CTxMemPoolEntry::nFee
private

Definition at line 58 of file txmempool.h.

◆ nModFeesWithAncestors

CAmount CTxMemPoolEntry::nModFeesWithAncestors
private

Definition at line 82 of file txmempool.h.

◆ nModFeesWithDescendants

CAmount CTxMemPoolEntry::nModFeesWithDescendants
private

... and size

Definition at line 77 of file txmempool.h.

◆ nSigOpCountWithAncestors

unsigned int CTxMemPoolEntry::nSigOpCountWithAncestors
private

Definition at line 83 of file txmempool.h.

◆ nSizeWithAncestors

uint64_t CTxMemPoolEntry::nSizeWithAncestors
private

Definition at line 81 of file txmempool.h.

◆ nSizeWithDescendants

uint64_t CTxMemPoolEntry::nSizeWithDescendants
private

number of descendant transactions

Definition at line 76 of file txmempool.h.

◆ nTime

int64_t CTxMemPoolEntry::nTime
private

... and checking if it contains shielded spends/outputs

Definition at line 64 of file txmempool.h.

◆ nTxSize

size_t CTxMemPoolEntry::nTxSize
private

Cached to avoid expensive parent-transaction lookups.

Definition at line 59 of file txmempool.h.

◆ nUsageSize

size_t CTxMemPoolEntry::nUsageSize
private

... and avoid recomputing tx size

Definition at line 60 of file txmempool.h.

◆ sigOpCount

unsigned int CTxMemPoolEntry::sigOpCount
private

keep track of transactions that spend a coinbase or a coinstake

Definition at line 67 of file txmempool.h.

◆ spendsCoinbaseOrCoinstake

bool CTxMemPoolEntry::spendsCoinbaseOrCoinstake
private

Chain height when entering the mempool.

Definition at line 66 of file txmempool.h.

◆ tx

CTransactionRef CTxMemPoolEntry::tx
private

Definition at line 57 of file txmempool.h.


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