![]() |
Dash Core
0.12.2.1
P2P Digital Currency
|
#include <txmempool.h>
Classes | |
struct | CompareIteratorByHash |
struct | TxLinks |
Public Types | |
typedef boost::multi_index_container< CTxMemPoolEntry, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< mempoolentry_txid >, boost::multi_index::ordered_non_unique< boost::multi_index::identity< CTxMemPoolEntry >, CompareTxMemPoolEntryByDescendantScore >, boost::multi_index::ordered_non_unique< boost::multi_index::identity< CTxMemPoolEntry >, CompareTxMemPoolEntryByEntryTime >, boost::multi_index::ordered_unique< boost::multi_index::identity< CTxMemPoolEntry >, CompareTxMemPoolEntryByScore > > > | indexed_transaction_set |
typedef indexed_transaction_set::nth_index< 0 >::type::iterator | txiter |
typedef std::set< txiter, CompareIteratorByHash > | setEntries |
Public Member Functions | |
const setEntries & | GetMemPoolParents (txiter entry) const |
const setEntries & | GetMemPoolChildren (txiter entry) const |
CTxMemPool (const CFeeRate &_minReasonableRelayFee) | |
~CTxMemPool () | |
void | check (const CCoinsViewCache *pcoins) const |
void | setSanityCheck (double dFrequency=1.0) |
bool | addUnchecked (const uint256 &hash, const CTxMemPoolEntry &entry, bool fCurrentEstimate=true) |
bool | addUnchecked (const uint256 &hash, const CTxMemPoolEntry &entry, setEntries &setAncestors, bool fCurrentEstimate=true) |
void | addAddressIndex (const CTxMemPoolEntry &entry, const CCoinsViewCache &view) |
bool | getAddressIndex (std::vector< std::pair< uint160, int > > &addresses, std::vector< std::pair< CMempoolAddressDeltaKey, CMempoolAddressDelta > > &results) |
bool | removeAddressIndex (const uint256 txhash) |
void | addSpentIndex (const CTxMemPoolEntry &entry, const CCoinsViewCache &view) |
bool | getSpentIndex (CSpentIndexKey &key, CSpentIndexValue &value) |
bool | removeSpentIndex (const uint256 txhash) |
void | remove (const CTransaction &tx, std::list< CTransaction > &removed, bool fRecursive=false) |
void | removeForReorg (const CCoinsViewCache *pcoins, unsigned int nMemPoolHeight, int flags) |
void | removeConflicts (const CTransaction &tx, std::list< CTransaction > &removed) |
void | removeForBlock (const std::vector< CTransaction > &vtx, unsigned int nBlockHeight, std::list< CTransaction > &conflicts, bool fCurrentEstimate=true) |
void | clear () |
void | _clear () |
void | queryHashes (std::vector< uint256 > &vtxid) |
void | pruneSpent (const uint256 &hash, CCoins &coins) |
unsigned int | GetTransactionsUpdated () const |
void | AddTransactionsUpdated (unsigned int n) |
bool | HasNoInputsOf (const CTransaction &tx) const |
void | PrioritiseTransaction (const uint256 hash, const std::string strHash, double dPriorityDelta, const CAmount &nFeeDelta) |
void | ApplyDeltas (const uint256 hash, double &dPriorityDelta, CAmount &nFeeDelta) const |
void | ClearPrioritisation (const uint256 hash) |
void | RemoveStaged (setEntries &stage) |
void | UpdateTransactionsFromBlock (const std::vector< uint256 > &hashesToUpdate) |
bool | CalculateMemPoolAncestors (const CTxMemPoolEntry &entry, setEntries &setAncestors, uint64_t limitAncestorCount, uint64_t limitAncestorSize, uint64_t limitDescendantCount, uint64_t limitDescendantSize, std::string &errString, bool fSearchForParents=true) |
void | CalculateDescendants (txiter it, setEntries &setDescendants) |
CFeeRate | GetMinFee (size_t sizelimit) const |
void | UpdateMinFee (const CFeeRate &_minReasonableRelayFee) |
void | TrimToSize (size_t sizelimit, std::vector< uint256 > *pvNoSpendsRemaining=NULL) |
int | Expire (int64_t time) |
unsigned long | size () |
uint64_t | GetTotalTxSize () |
bool | exists (uint256 hash) const |
bool | lookup (uint256 hash, CTransaction &result) const |
CFeeRate | estimateSmartFee (int nBlocks, int *answerFoundAtBlocks=NULL) const |
CFeeRate | estimateFee (int nBlocks) const |
double | estimateSmartPriority (int nBlocks, int *answerFoundAtBlocks=NULL) const |
double | estimatePriority (int nBlocks) const |
bool | WriteFeeEstimates (CAutoFile &fileout) const |
bool | ReadFeeEstimates (CAutoFile &filein) |
size_t | DynamicMemoryUsage () const |
Public Attributes | |
CCriticalSection | cs |
indexed_transaction_set | mapTx |
std::map< COutPoint, CInPoint > | mapNextTx |
std::map< uint256, std::pair< double, CAmount > > | mapDeltas |
Static Public Attributes | |
static const int | ROLLING_FEE_HALFLIFE = 60 * 60 * 12 |
Private Types | |
typedef std::map< txiter, setEntries, CompareIteratorByHash > | cacheMap |
typedef std::map< txiter, TxLinks, CompareIteratorByHash > | txlinksMap |
typedef std::map< CMempoolAddressDeltaKey, CMempoolAddressDelta, CMempoolAddressDeltaKeyCompare > | addressDeltaMap |
typedef std::map< uint256, std::vector< CMempoolAddressDeltaKey > > | addressDeltaMapInserted |
typedef std::map< CSpentIndexKey, CSpentIndexValue, CSpentIndexKeyCompare > | mapSpentIndex |
typedef std::map< uint256, std::vector< CSpentIndexKey > > | mapSpentIndexInserted |
Private Member Functions | |
void | trackPackageRemoved (const CFeeRate &rate) |
minimum fee to get into the pool, decreases exponentially More... | |
void | UpdateParent (txiter entry, txiter parent, bool add) |
void | UpdateChild (txiter entry, txiter child, bool add) |
bool | UpdateForDescendants (txiter updateIt, int maxDescendantsToVisit, cacheMap &cachedDescendants, const std::set< uint256 > &setExclude) |
void | UpdateAncestorsOf (bool add, txiter hash, setEntries &setAncestors) |
void | UpdateForRemoveFromMempool (const setEntries &entriesToRemove) |
void | UpdateChildrenForRemoval (txiter entry) |
void | removeUnchecked (txiter entry) |
Private Attributes | |
uint32_t | nCheckFrequency |
unsigned int | nTransactionsUpdated |
Value n means that n times in 2^32 we check. More... | |
CBlockPolicyEstimator * | minerPolicyEstimator |
uint64_t | totalTxSize |
uint64_t | cachedInnerUsage |
sum of all mempool tx' byte sizes More... | |
CFeeRate | minReasonableRelayFee |
sum of dynamic memory usage of all the map elements (NOT the maps themselves) More... | |
int64_t | lastRollingFeeUpdate |
bool | blockSinceLastRollingFeeBump |
double | rollingMinimumFeeRate |
txlinksMap | mapLinks |
addressDeltaMap | mapAddress |
addressDeltaMapInserted | mapAddressInserted |
mapSpentIndex | mapSpent |
mapSpentIndexInserted | mapSpentInserted |
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the next block.
Transactions are added when they are seen on the network (or created by the local node), but not all transactions seen are added to the pool: if a new transaction double-spends an input of a transaction in the pool, it is dropped, as are non-standard transactions.
CTxMemPool::mapTx, and CTxMemPoolEntry bookkeeping:
mapTx is a boost::multi_index that sorts the mempool on 4 criteria:
Note: the term "descendant" refers to in-mempool transactions that depend on this one, while "ancestor" refers to in-mempool transactions that a given transaction depends on.
In order for the feerate sort to remain correct, we must update transactions in the mempool when new descendants arrive. To facilitate this, we track the set of in-mempool direct parents and direct children in mapLinks. Within each CTxMemPoolEntry, we track the size and fees of all descendants.
Usually when a new transaction is added to the mempool, it has no in-mempool children (because any such children would be an orphan). So in addUnchecked(), we:
When a transaction is removed from the mempool, we must:
These happen in UpdateForRemoveFromMempool(). (Note that when removing a transaction along with its descendants, we must calculate that set of transactions to be removed before doing the removal, or else the mempool can be in an inconsistent state where it's impossible to walk the ancestors of a transaction.)
In the event of a reorg, the assumption that a newly added tx has no in-mempool children is false. In particular, the mempool is in an inconsistent state while new transactions are being added, because there may be descendant transactions of a tx coming from a disconnected block that are unreachable from just looking at transactions in the mempool (the linking transactions may also be in the disconnected block, waiting to be added). Because of this, there's not much benefit in trying to search for in-mempool children in addUnchecked(). Instead, in the special case of transactions being added from a disconnected block, we require the caller to clean up the state, to account for in-mempool, out-of-block descendants for all the in-block transactions by calling UpdateTransactionsFromBlock(). Note that until this is called, the mempool state is not consistent, and in particular mapLinks may not be correct (and therefore functions like CalculateMemPoolAncestors() and CalculateDescendants() that rely on them to walk the mempool are not generally safe to use).
Computational limits:
Updating all in-mempool ancestors of a newly added transaction can be slow, if no bound exists on how many in-mempool ancestors there may be. CalculateMemPoolAncestors() takes configurable limits that are designed to prevent these calculations from being too CPU intensive.
Adding transactions from a disconnected block can be very time consuming, because we don't have a way to limit the number of in-mempool descendants. To bound CPU processing, we limit the amount of work we're willing to do to properly update the descendant information for a tx being added from a disconnected block. If we would exceed the limit, then we instead mark the entry as "dirty", and set the feerate for sorting purposes to be equal the feerate of the transaction without any descendants.
Definition at line 357 of file txmempool.h.
|
private |
Definition at line 425 of file txmempool.h.
|
private |
Definition at line 428 of file txmempool.h.
|
private |
Definition at line 415 of file txmempool.h.
typedef boost::multi_index_container< CTxMemPoolEntry, boost::multi_index::indexed_by< boost::multi_index::ordered_unique<mempoolentry_txid>, boost::multi_index::ordered_non_unique< boost::multi_index::identity<CTxMemPoolEntry>, CompareTxMemPoolEntryByDescendantScore >, boost::multi_index::ordered_non_unique< boost::multi_index::identity<CTxMemPoolEntry>, CompareTxMemPoolEntryByEntryTime >, boost::multi_index::ordered_unique< boost::multi_index::identity<CTxMemPoolEntry>, CompareTxMemPoolEntryByScore > > > CTxMemPool::indexed_transaction_set |
Definition at line 400 of file txmempool.h.
|
private |
Definition at line 431 of file txmempool.h.
|
private |
Definition at line 434 of file txmempool.h.
typedef std::set<txiter, CompareIteratorByHash> CTxMemPool::setEntries |
Definition at line 410 of file txmempool.h.
typedef indexed_transaction_set::nth_index<0>::type::iterator CTxMemPool::txiter |
Definition at line 404 of file txmempool.h.
|
private |
Definition at line 422 of file txmempool.h.
CTxMemPool::CTxMemPool | ( | const CFeeRate & | _minReasonableRelayFee | ) |
Create a new CTxMemPool. minReasonableRelayFee should be a feerate which is, roughly, somewhere around what it "costs" to relay a transaction around the network and below which we would reasonably say a transaction has 0-effective-fee.
Definition at line 328 of file txmempool.cpp.
CTxMemPool::~CTxMemPool | ( | ) |
Definition at line 342 of file txmempool.cpp.
void CTxMemPool::_clear | ( | ) |
Definition at line 732 of file txmempool.cpp.
Referenced by clear(), and CTxMemPool().
void CTxMemPool::addAddressIndex | ( | const CTxMemPoolEntry & | entry, |
const CCoinsViewCache & | view | ||
) |
Definition at line 426 of file txmempool.cpp.
Referenced by AcceptToMemoryPoolWorker().
void CTxMemPool::addSpentIndex | ( | const CTxMemPoolEntry & | entry, |
const CCoinsViewCache & | view | ||
) |
Definition at line 500 of file txmempool.cpp.
Referenced by AcceptToMemoryPoolWorker().
void CTxMemPool::AddTransactionsUpdated | ( | unsigned int | n | ) |
Definition at line 366 of file txmempool.cpp.
Referenced by PrepareShutdown(), and UpdateTip().
bool CTxMemPool::addUnchecked | ( | const uint256 & | hash, |
const CTxMemPoolEntry & | entry, | ||
bool | fCurrentEstimate = true |
||
) |
Definition at line 1030 of file txmempool.cpp.
Referenced by AcceptToMemoryPoolWorker().
bool CTxMemPool::addUnchecked | ( | const uint256 & | hash, |
const CTxMemPoolEntry & | entry, | ||
setEntries & | setAncestors, | ||
bool | fCurrentEstimate = true |
||
) |
Definition at line 372 of file txmempool.cpp.
void CTxMemPool::ApplyDeltas | ( | const uint256 | hash, |
double & | dPriorityDelta, | ||
CAmount & | nFeeDelta | ||
) | const |
Definition at line 957 of file txmempool.cpp.
Referenced by AcceptToMemoryPoolWorker(), and CreateNewBlock().
void CTxMemPool::CalculateDescendants | ( | txiter | it, |
setEntries & | setDescendants | ||
) |
Populate setDescendants with all in-mempool descendants of hash. Assumes that setDescendants includes all in-mempool descendants of anything already in it.
Definition at line 588 of file txmempool.cpp.
Referenced by AcceptToMemoryPoolWorker(), Expire(), remove(), and TrimToSize().
bool CTxMemPool::CalculateMemPoolAncestors | ( | const CTxMemPoolEntry & | entry, |
setEntries & | setAncestors, | ||
uint64_t | limitAncestorCount, | ||
uint64_t | limitAncestorSize, | ||
uint64_t | limitDescendantCount, | ||
uint64_t | limitDescendantSize, | ||
std::string & | errString, | ||
bool | fSearchForParents = true |
||
) |
Try to calculate all in-mempool ancestors of entry. (these are all calculated including the tx itself) limitAncestorCount = max number of ancestors limitAncestorSize = max size of ancestors limitDescendantCount = max number of descendants any ancestor can have limitDescendantSize = max size of descendants any ancestor can have errString = populated with error reason if any limits are hit fSearchForParents = whether to search a tx's vin for in-mempool parents, or look up parents from mapLinks. Must be true for entries not in the mempool
Definition at line 183 of file txmempool.cpp.
Referenced by AcceptToMemoryPoolWorker(), addUnchecked(), IsRBFOptIn(), PrioritiseTransaction(), and UpdateForRemoveFromMempool().
void CTxMemPool::check | ( | const CCoinsViewCache * | pcoins | ) | const |
If sanity-checking is turned on, check makes sure the pool is consistent (does not contain two transactions that spend the same inputs, all inputs are in the mapNextTx array). If sanity-checking is turned off, check does nothing.
Definition at line 751 of file txmempool.cpp.
Referenced by ActivateBestChainStep(), and ProcessMessage().
void CTxMemPool::clear | ( | ) |
Definition at line 745 of file txmempool.cpp.
Referenced by UnloadBlockIndex().
void CTxMemPool::ClearPrioritisation | ( | const uint256 | hash | ) |
Definition at line 968 of file txmempool.cpp.
Referenced by removeConflicts(), and removeForBlock().
size_t CTxMemPool::DynamicMemoryUsage | ( | ) | const |
Definition at line 1000 of file txmempool.cpp.
Referenced by ClientModel::getMempoolDynamicUsage(), GetMinFee(), mempoolInfoToJSON(), ProcessMessage(), and TrimToSize().
CFeeRate CTxMemPool::estimateFee | ( | int | nBlocks | ) | const |
Estimate fee rate needed to get into the next nBlocks
Definition at line 878 of file txmempool.cpp.
Referenced by estimatefee().
double CTxMemPool::estimatePriority | ( | int | nBlocks | ) | const |
Estimate priority needed to get into the next nBlocks
Definition at line 888 of file txmempool.cpp.
Referenced by estimatepriority().
CFeeRate CTxMemPool::estimateSmartFee | ( | int | nBlocks, |
int * | answerFoundAtBlocks = NULL |
||
) | const |
Estimate fee rate needed to get into the next nBlocks If no answer can be given at nBlocks, return an estimate at the lowest number of blocks where one can be given
Definition at line 883 of file txmempool.cpp.
Referenced by estimatesmartfee(), CWallet::GetMinimumFee(), CoinControlDialog::updateLabels(), and SendCoinsDialog::updateSmartFeeLabel().
double CTxMemPool::estimateSmartPriority | ( | int | nBlocks, |
int * | answerFoundAtBlocks = NULL |
||
) | const |
Estimate priority needed to get into the next nBlocks If no answer can be given at nBlocks, return an estimate at the lowest number of blocks where one can be given
Definition at line 893 of file txmempool.cpp.
Referenced by CWallet::CreateTransaction(), estimatesmartpriority(), and CoinControlDialog::updateLabels().
|
inline |
Definition at line 563 of file txmempool.h.
Referenced by AcceptToMemoryPoolWorker(), AlreadyHave(), DisconnectTip(), CMerkleTx::GetDepthInMainChain(), HasNoInputsOf(), CCoinsViewMemPool::HaveCoins(), CWalletTx::InMempool(), IsRBFOptIn(), mempoolToJSON(), sendrawtransaction(), TrimToSize(), and WalletTxToJSON().
int CTxMemPool::Expire | ( | int64_t | time | ) |
Expire all transaction (and their dependencies) in the mempool older than time. Return the number of removed transactions.
Definition at line 1014 of file txmempool.cpp.
Referenced by LimitMempoolSize().
bool CTxMemPool::getAddressIndex | ( | std::vector< std::pair< uint160, int > > & | addresses, |
std::vector< std::pair< CMempoolAddressDeltaKey, CMempoolAddressDelta > > & | results | ||
) |
Definition at line 470 of file txmempool.cpp.
Referenced by getaddressmempool().
const CTxMemPool::setEntries & CTxMemPool::GetMemPoolChildren | ( | txiter | entry | ) | const |
Definition at line 1068 of file txmempool.cpp.
Referenced by CalculateDescendants(), check(), CreateNewBlock(), UpdateChildrenForRemoval(), and UpdateForDescendants().
const CTxMemPool::setEntries & CTxMemPool::GetMemPoolParents | ( | txiter | entry | ) | const |
Definition at line 1060 of file txmempool.cpp.
Referenced by CalculateMemPoolAncestors(), check(), CreateNewBlock(), and UpdateAncestorsOf().
CFeeRate CTxMemPool::GetMinFee | ( | size_t | sizelimit | ) | const |
The minimum fee to get into the mempool, which may itself not be enough for larger-sized transactions. The minReasonableRelayFee constructor arg is used to bound the time it takes the fee rate to go back down all the way to 0. When the feerate would otherwise be half of this, it is set to 0 instead.
Definition at line 1076 of file txmempool.cpp.
Referenced by AcceptToMemoryPoolWorker(), CBlockPolicyEstimator::estimateSmartFee(), CBlockPolicyEstimator::estimateSmartPriority(), and mempoolInfoToJSON().
bool CTxMemPool::getSpentIndex | ( | CSpentIndexKey & | key, |
CSpentIndexValue & | value | ||
) |
Definition at line 536 of file txmempool.cpp.
Referenced by GetSpentIndex().
|
inline |
Definition at line 557 of file txmempool.h.
Referenced by mempoolInfoToJSON().
unsigned int CTxMemPool::GetTransactionsUpdated | ( | ) | const |
Definition at line 360 of file txmempool.cpp.
Referenced by BitcoinMiner(), and getblocktemplate().
bool CTxMemPool::HasNoInputsOf | ( | const CTransaction & | tx | ) | const |
Check that none of this transactions inputs are in the mempool, and thus the tx is not dependent on other mempool transactions to be included in a block.
Definition at line 974 of file txmempool.cpp.
Referenced by AcceptToMemoryPoolWorker().
bool CTxMemPool::lookup | ( | uint256 | hash, |
CTransaction & | result | ||
) | const |
Definition at line 869 of file txmempool.cpp.
Referenced by CCoinsViewMemPool::GetCoins(), GetTransaction(), ProcessGetData(), and ProcessMessage().
void CTxMemPool::PrioritiseTransaction | ( | const uint256 | hash, |
const std::string | strHash, | ||
double | dPriorityDelta, | ||
const CAmount & | nFeeDelta | ||
) |
Affect CreateNewBlock prioritisation of transactions
Definition at line 934 of file txmempool.cpp.
Referenced by CPrivateSendServer::CommitFinalTransaction(), prioritisetransaction(), CPrivateSendServer::ProcessMessage(), ProcessMessage(), and CPrivateSendClient::SendDenominate().
Definition at line 347 of file txmempool.cpp.
Referenced by gettxout(), and rest_getutxos().
void CTxMemPool::queryHashes | ( | std::vector< uint256 > & | vtxid | ) |
Definition at line 859 of file txmempool.cpp.
Referenced by mempoolToJSON(), and ProcessMessage().
bool CTxMemPool::ReadFeeEstimates | ( | CAutoFile & | filein | ) |
Definition at line 916 of file txmempool.cpp.
Referenced by AppInit2().
void CTxMemPool::remove | ( | const CTransaction & | tx, |
std::list< CTransaction > & | removed, | ||
bool | fRecursive = false |
||
) |
Definition at line 611 of file txmempool.cpp.
Referenced by DisconnectTip().
bool CTxMemPool::removeAddressIndex | ( | const uint256 | txhash | ) |
Definition at line 484 of file txmempool.cpp.
Referenced by removeUnchecked().
void CTxMemPool::removeConflicts | ( | const CTransaction & | tx, |
std::list< CTransaction > & | removed | ||
) |
Definition at line 685 of file txmempool.cpp.
Referenced by removeForBlock().
void CTxMemPool::removeForBlock | ( | const std::vector< CTransaction > & | vtx, |
unsigned int | nBlockHeight, | ||
std::list< CTransaction > & | conflicts, | ||
bool | fCurrentEstimate = true |
||
) |
Called when a block is connected. Removes from mempool and updates the miner fee estimator.
Definition at line 706 of file txmempool.cpp.
Referenced by ConnectTip().
void CTxMemPool::removeForReorg | ( | const CCoinsViewCache * | pcoins, |
unsigned int | nMemPoolHeight, | ||
int | flags | ||
) |
Definition at line 649 of file txmempool.cpp.
Referenced by ActivateBestChainStep(), and InvalidateBlock().
bool CTxMemPool::removeSpentIndex | ( | const uint256 | txhash | ) |
Definition at line 549 of file txmempool.cpp.
Referenced by removeUnchecked().
void CTxMemPool::RemoveStaged | ( | setEntries & | stage | ) |
Remove a set of transactions from the mempool. If a transaction is in this set, then all in-mempool descendants must also be in the set.
Definition at line 1006 of file txmempool.cpp.
Referenced by AcceptToMemoryPoolWorker(), Expire(), remove(), and TrimToSize().
|
private |
Before calling removeUnchecked for a given transaction, UpdateForRemoveFromMempool must be called on the entire (dependent) set of transactions being removed at the same time. We use each CTxMemPoolEntry's setMemPoolParents in order to walk ancestors of a given transaction that is removed, so we can't remove intermediate transactions in a chain before we've updated all the state for the removal.
Definition at line 565 of file txmempool.cpp.
Referenced by RemoveStaged().
|
inline |
Definition at line 459 of file txmempool.h.
Referenced by AppInit2().
|
inline |
Definition at line 551 of file txmempool.h.
Referenced by ClientModel::getMempoolSize(), getmininginfo(), mempoolInfoToJSON(), and ProcessMessage().
|
private |
minimum fee to get into the pool, decreases exponentially
Definition at line 1108 of file txmempool.cpp.
Referenced by TrimToSize().
void CTxMemPool::TrimToSize | ( | size_t | sizelimit, |
std::vector< uint256 > * | pvNoSpendsRemaining = NULL |
||
) |
Remove transactions from the mempool until its dynamic size is <= sizelimit. pvNoSpendsRemaining, if set, will be populated with the list of transactions which are not in mempool which no longer have any spends in this mempool.
Definition at line 1116 of file txmempool.cpp.
Referenced by LimitMempoolSize().
|
private |
Update ancestors of hash to add/remove it as a descendant transaction.
Definition at line 245 of file txmempool.cpp.
Referenced by addUnchecked(), and UpdateForRemoveFromMempool().
Definition at line 1040 of file txmempool.cpp.
Referenced by UpdateAncestorsOf(), and UpdateTransactionsFromBlock().
|
private |
Sever link between specified transaction and direct children.
Definition at line 260 of file txmempool.cpp.
Referenced by UpdateForRemoveFromMempool().
|
private |
UpdateForDescendants is used by UpdateTransactionsFromBlock to update the descendants for a single transaction that has been added to the mempool but may have child transactions in the mempool, eg during a chain reorg. setExclude is the set of descendant transactions in the mempool that must not be accounted for (because any descendants in setExclude were added to the mempool after the transaction being updated and hence their state is already reflected in the parent state).
If updating an entry requires looking at more than maxDescendantsToVisit transactions, outside of the ones in setExclude, then give up.
cachedDescendants will be updated with the descendants of the transaction being updated, so that future invocations don't need to walk the same transaction again, if encountered in another transaction chain.
Definition at line 73 of file txmempool.cpp.
Referenced by UpdateTransactionsFromBlock().
|
private |
For each transaction being removed, update ancestors and any direct children.
Definition at line 268 of file txmempool.cpp.
Referenced by RemoveStaged().
void CTxMemPool::UpdateMinFee | ( | const CFeeRate & | _minReasonableRelayFee | ) |
Definition at line 1100 of file txmempool.cpp.
Referenced by CDSNotificationInterface::UpdatedBlockTip().
Definition at line 1050 of file txmempool.cpp.
Referenced by addUnchecked(), UpdateChildrenForRemoval(), and UpdateTransactionsFromBlock().
void CTxMemPool::UpdateTransactionsFromBlock | ( | const std::vector< uint256 > & | hashesToUpdate | ) |
When adding transactions from a disconnected block back to the mempool, new mempool entries may have children in the mempool (which is generally not the case when otherwise adding transactions). UpdateTransactionsFromBlock() will find child transactions and update the descendant state for each transaction in hashesToUpdate (excluding any child transactions present in hashesToUpdate, which are already accounted for). Note: hashesToUpdate should be the set of transactions from the disconnected block that have been accepted back into the mempool.
Definition at line 137 of file txmempool.cpp.
Referenced by DisconnectTip().
bool CTxMemPool::WriteFeeEstimates | ( | CAutoFile & | fileout | ) | const |
Write/Read estimates to disk
Definition at line 900 of file txmempool.cpp.
Referenced by PrepareShutdown().
|
mutableprivate |
Definition at line 370 of file txmempool.h.
Referenced by _clear(), GetMinFee(), removeForBlock(), and trackPackageRemoved().
|
private |
sum of all mempool tx' byte sizes
Definition at line 365 of file txmempool.h.
Referenced by _clear(), addUnchecked(), check(), DynamicMemoryUsage(), removeUnchecked(), UpdateChild(), and UpdateParent().
|
mutable |
Definition at line 402 of file txmempool.h.
Referenced by AcceptToMemoryPoolWorker(), addAddressIndex(), addSpentIndex(), AddTransactionsUpdated(), addUnchecked(), ApplyDeltas(), check(), CheckSequenceLocks(), clear(), ClearPrioritisation(), CreateNewBlock(), DynamicMemoryUsage(), estimateFee(), estimatePriority(), estimateSmartFee(), estimateSmartPriority(), exists(), Expire(), getAddressIndex(), GetMinFee(), getSpentIndex(), GetTotalTxSize(), GetTransactionsUpdated(), gettxout(), CWalletTx::InMempool(), IsRBFOptIn(), lookup(), mempoolToJSON(), PrioritiseTransaction(), pruneSpent(), queryHashes(), CWallet::ReacceptWalletTransactions(), ReadFeeEstimates(), remove(), removeAddressIndex(), removeConflicts(), removeForBlock(), removeForReorg(), removeSpentIndex(), RemoveStaged(), CInstantSend::ResolveConflicts(), rest_getutxos(), signrawtransaction(), size(), trackPackageRemoved(), TrimToSize(), UpdateMinFee(), UpdateTransactionsFromBlock(), WalletTxToJSON(), and WriteFeeEstimates().
|
mutableprivate |
Definition at line 369 of file txmempool.h.
Referenced by _clear(), GetMinFee(), and removeForBlock().
|
private |
Definition at line 426 of file txmempool.h.
Referenced by addAddressIndex(), getAddressIndex(), and removeAddressIndex().
|
private |
Definition at line 429 of file txmempool.h.
Referenced by addAddressIndex(), and removeAddressIndex().
Definition at line 442 of file txmempool.h.
Referenced by addUnchecked(), ApplyDeltas(), ClearPrioritisation(), DynamicMemoryUsage(), and PrioritiseTransaction().
|
private |
Definition at line 423 of file txmempool.h.
Referenced by _clear(), addUnchecked(), check(), DynamicMemoryUsage(), GetMemPoolChildren(), GetMemPoolParents(), removeUnchecked(), UpdateChild(), and UpdateParent().
Definition at line 441 of file txmempool.h.
Referenced by _clear(), AcceptToMemoryPoolWorker(), addUnchecked(), check(), DynamicMemoryUsage(), pruneSpent(), remove(), removeConflicts(), removeUnchecked(), CInstantSend::ResolveConflicts(), TrimToSize(), and UpdateTransactionsFromBlock().
|
private |
Definition at line 432 of file txmempool.h.
Referenced by addSpentIndex(), getSpentIndex(), and removeSpentIndex().
|
private |
Definition at line 435 of file txmempool.h.
Referenced by addSpentIndex(), and removeSpentIndex().
indexed_transaction_set CTxMemPool::mapTx |
Definition at line 403 of file txmempool.h.
Referenced by _clear(), AcceptToMemoryPoolWorker(), addUnchecked(), CalculateMemPoolAncestors(), check(), CreateNewBlock(), DynamicMemoryUsage(), exists(), Expire(), GetMemPoolChildren(), GetMemPoolParents(), lookup(), mempoolToJSON(), PrioritiseTransaction(), queryHashes(), remove(), removeForBlock(), removeForReorg(), removeUnchecked(), size(), TrimToSize(), UpdateAncestorsOf(), UpdateForDescendants(), UpdateTransactionsFromBlock(), and WalletTxToJSON().
|
private |
Definition at line 362 of file txmempool.h.
Referenced by addUnchecked(), CTxMemPool(), estimateFee(), estimatePriority(), estimateSmartFee(), estimateSmartPriority(), ReadFeeEstimates(), removeForBlock(), removeUnchecked(), UpdateMinFee(), WriteFeeEstimates(), and ~CTxMemPool().
|
private |
sum of dynamic memory usage of all the map elements (NOT the maps themselves)
Definition at line 367 of file txmempool.h.
Referenced by CTxMemPool(), GetMinFee(), TrimToSize(), and UpdateMinFee().
|
private |
Definition at line 360 of file txmempool.h.
Referenced by check(), CTxMemPool(), removeForReorg(), and setSanityCheck().
|
private |
Value n means that n times in 2^32 we check.
Definition at line 361 of file txmempool.h.
Referenced by _clear(), AddTransactionsUpdated(), addUnchecked(), GetTransactionsUpdated(), and removeUnchecked().
|
static |
Definition at line 377 of file txmempool.h.
Referenced by GetMinFee().
|
mutableprivate |
Definition at line 371 of file txmempool.h.
Referenced by _clear(), GetMinFee(), and trackPackageRemoved().
|
private |
Definition at line 364 of file txmempool.h.
Referenced by _clear(), addUnchecked(), check(), GetTotalTxSize(), and removeUnchecked().