![]() |
Dash Core
0.12.2.1
P2P Digital Currency
|
#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 CTransaction & | GetTx () const |
double | GetPriority (unsigned int currentHeight) const |
const CAmount & | GetFee () 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 LockPoints & | GetLockPoints () 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... | |
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.
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::CTxMemPoolEntry | ( | const CTxMemPoolEntry & | other | ) |
Definition at line 44 of file txmempool.cpp.
|
inline |
Definition at line 123 of file txmempool.h.
Referenced by CTxMemPool::addUnchecked().
|
inline |
Definition at line 141 of file txmempool.h.
Referenced by mempoolToJSON().
|
inline |
Definition at line 116 of file txmempool.h.
Referenced by mempoolToJSON(), CBlockPolicyEstimator::processBlockTx(), and CBlockPolicyEstimator::processTransaction().
|
inline |
Definition at line 119 of file txmempool.h.
Referenced by mempoolToJSON(), CBlockPolicyEstimator::processBlockTx(), and CBlockPolicyEstimator::processTransaction().
|
inline |
Definition at line 124 of file txmempool.h.
|
inline |
Definition at line 143 of file txmempool.h.
Referenced by mempoolToJSON(), CompareTxMemPoolEntryByDescendantScore::operator()(), and CompareTxMemPoolEntryByDescendantScore::UseDescendantScore().
|
inline |
Definition at line 122 of file txmempool.h.
Referenced by mempoolToJSON(), CompareTxMemPoolEntryByDescendantScore::operator()(), CompareTxMemPoolEntryByScore::operator()(), SetDirty(), and CompareTxMemPoolEntryByDescendantScore::UseDescendantScore().
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().
|
inline |
Definition at line 121 of file txmempool.h.
|
inline |
Definition at line 142 of file txmempool.h.
Referenced by mempoolToJSON(), CompareTxMemPoolEntryByDescendantScore::operator()(), and CompareTxMemPoolEntryByDescendantScore::UseDescendantScore().
|
inline |
Definition at line 145 of file txmempool.h.
|
inline |
Definition at line 118 of file txmempool.h.
Referenced by CTxMemPool::addAddressIndex(), mempoolToJSON(), CompareTxMemPoolEntryByDescendantScore::operator()(), and CompareTxMemPoolEntryByEntryTime::operator()().
|
inline |
Definition at line 110 of file txmempool.h.
Referenced by CTxMemPool::addAddressIndex(), CTxMemPool::addSpentIndex(), CTxMemPool::CalculateMemPoolAncestors(), CTxMemPool::check(), IsRBFOptIn(), mempoolToJSON(), mempoolentry_txid::operator()(), CompareTxMemPoolEntryByScore::operator()(), and CBlockPolicyEstimator::processTransaction().
|
inline |
Definition at line 117 of file txmempool.h.
Referenced by AcceptToMemoryPoolWorker(), CTxMemPool::addUnchecked(), CTxMemPool::CalculateMemPoolAncestors(), mempoolToJSON(), CompareTxMemPoolEntryByDescendantScore::operator()(), CompareTxMemPoolEntryByScore::operator()(), CBlockPolicyEstimator::processBlockTx(), CBlockPolicyEstimator::processTransaction(), and CompareTxMemPoolEntryByDescendantScore::UseDescendantScore().
|
inline |
Definition at line 139 of file txmempool.h.
Referenced by UpdateState().
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()().
void CTxMemPoolEntry::UpdateFeeDelta | ( | int64_t | feeDelta | ) |
Definition at line 59 of file txmempool.cpp.
Referenced by update_fee_delta::operator()().
void CTxMemPoolEntry::UpdateLockPoints | ( | const LockPoints & | lp | ) |
Definition at line 65 of file txmempool.cpp.
Referenced by update_lock_points::operator()().
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()().
|
inline |
Definition at line 120 of file txmempool.h.
Referenced by CBlockPolicyEstimator::processBlockTx(), and CBlockPolicyEstimator::processTransaction().
|
private |
Priority when entering the mempool.
Definition at line 86 of file txmempool.h.
Referenced by GetHeight(), and GetPriority().
|
private |
Local time when entering the mempool.
Definition at line 85 of file txmempool.h.
Referenced by GetPriority().
|
private |
Legacy sig ops plus P2SH sig op count.
Definition at line 91 of file txmempool.h.
Referenced by CTxMemPoolEntry(), GetModifiedFee(), and UpdateFeeDelta().
|
private |
Chain height when entering the mempool.
Definition at line 87 of file txmempool.h.
Referenced by WasClearAtEntry().
|
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().
|
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().
|
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().
|
private |
Definition at line 80 of file txmempool.h.
Referenced by CTxMemPoolEntry(), GetFee(), and GetModifiedFee().
|
private |
... and size
Definition at line 101 of file txmempool.h.
Referenced by CTxMemPoolEntry(), GetModFeesWithDescendants(), SetDirty(), UpdateFeeDelta(), and UpdateState().
|
private |
... and avoid recomputing tx size
Definition at line 82 of file txmempool.h.
Referenced by CTxMemPoolEntry(), and GetPriority().
|
private |
number of descendant transactions
Definition at line 100 of file txmempool.h.
Referenced by CTxMemPoolEntry(), GetSizeWithDescendants(), SetDirty(), and UpdateState().
|
private |
|
private |
Cached to avoid expensive parent-transaction lookups.
Definition at line 81 of file txmempool.h.
Referenced by CTxMemPoolEntry(), GetTxSize(), and SetDirty().
|
private |
... and modified size for priority
Definition at line 83 of file txmempool.h.
Referenced by CTxMemPoolEntry(), and DynamicMemoryUsage().
|
private |
keep track of transactions that spend a coinbase
Definition at line 90 of file txmempool.h.
Referenced by GetSigOpCount().
|
private |
Sum of all txin values that are already in blockchain.
Definition at line 89 of file txmempool.h.
Referenced by GetSpendsCoinbase().
|
private |
Definition at line 79 of file txmempool.h.
Referenced by CTxMemPoolEntry(), and GetTx().