Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
•All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
txmempool.h
Go to the documentation of this file.
116 void UpdateAncestorState(int64_t modifySize, CAmount modifyFee, int64_t modifyCount, int64_t modifySigOps);
159 update_ancestor_state(int64_t _modifySize, CAmount _modifyFee, int64_t _modifyCount, int _modifySigOps) :
160 modifySize(_modifySize), modifyFee(_modifyFee), modifyCount(_modifyCount), modifySigOps(_modifySigOps)
514 typedef std::map<CMempoolAddressDeltaKey, CMempoolAddressDelta, CMempoolAddressDeltaKeyCompare> addressDeltaMap;
526 std::multimap<uint256, uint256> mapProTxRefs; // proTxHash -> transaction (all TXs that refer to an existing proTx)
552 void setSanityCheck(double dFrequency = 1.0) { nCheckFrequency = static_cast<uint32_t>(dFrequency * 4294967295.0); }
561 bool addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry, bool validFeeEstimate = true);
562 bool addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry, setEntries &setAncestors, bool validFeeEstimate = true);
573 void removeRecursive(const CTransaction &tx, MemPoolRemovalReason reason = MemPoolRemovalReason::UNKNOWN);
578 void removeProTxCollateralConflicts(const CTransaction &tx, const COutPoint &collateralOutpoint);
580 void removeProTxKeyChangedConflicts(const CTransaction &tx, const uint256& proTxHash, const uint256& newKeyHash);
610 void RemoveStaged(setEntries &stage, bool updateDescendants, MemPoolRemovalReason reason = MemPoolRemovalReason::UNKNOWN);
633 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) const;
725 void removeUnchecked(txiter entry, MemPoolRemovalReason reason = MemPoolRemovalReason::UNKNOWN);
801 return memusage::MallocUsage(sizeof(CTransactionRef) + 6 * sizeof(void*)) * queuedTx.size() + cachedInnerUsage;
827 void removeEntry(indexed_disconnected_transactions::index<insertion_order>::type::iterator entry)
Definition: txmempool.h:324
CAmount GetModFeesWithAncestors() const
Definition: txmempool.h:131
bool existsProviderTxConflict(const CTransaction &tx) const
Definition: txmempool.cpp:1229
Definition: txmempool.h:506
Definition: txmempool.h:358
int Expire(int64_t time)
Expire all transaction (and their dependencies) in the mempool older than time.
Definition: txmempool.cpp:1403
uint64_t GetSizeWithAncestors() const
Definition: txmempool.h:130
void UpdateEntryForAncestors(txiter it, const setEntries &setAncestors)
Set ancestor state for an entry.
Definition: txmempool.cpp:233
void UpdateLockPoints(const LockPoints &lp)
Definition: txmempool.cpp:56
std::map< txiter, TxLinks, CompareIteratorByHash > txlinksMap
Definition: txmempool.h:511
void addSpentIndex(const CTxMemPoolEntry &entry, const CCoinsViewCache &view)
Definition: txmempool.cpp:555
std::map< CKeyID, uint256 > mapProTxPubKeyIDs
Definition: txmempool.h:528
bool getAddressIndex(std::vector< std::pair< uint160, int > > &addresses, std::vector< std::pair< CMempoolAddressDeltaKey, CMempoolAddressDelta > > &results)
Definition: txmempool.cpp:525
void removeConflicts(const CTransaction &tx)
Definition: txmempool.cpp:794
Definition: txmempool.h:40
Definition: txmempool.h:194
void removeRecursive(const CTransaction &tx, MemPoolRemovalReason reason=MemPoolRemovalReason::UNKNOWN)
Definition: txmempool.cpp:725
void trackPackageRemoved(const CFeeRate &rate)
Definition: txmempool.cpp:1494
CTxMemPoolEntry(const CTransactionRef &_tx, const CAmount &_nFee, int64_t _nTime, unsigned int _entryHeight, bool spendsCoinbase, unsigned int nSigOps, LockPoints lp)
Definition: txmempool.cpp:28
void removeProTxKeyChangedConflicts(const CTransaction &tx, const uint256 &proTxHash, const uint256 &newKeyHash)
Definition: txmempool.cpp:877
~DisconnectedBlockTransactions()
Definition: txmempool.h:793
boost::signals2::signal< void(CTransactionRef)> NotifyEntryAdded
Definition: txmempool.h:686
bool GetCoin(const COutPoint &outpoint, Coin &coin) const override
Retrieve the Coin (unspent transaction output) for a given outpoint.
Definition: txmempool.cpp:1373
bool operator()(const CTxMemPoolEntry &a, const CTxMemPoolEntry &b) const
Definition: txmempool.h:271
Expired from mempool.
Definition: txmempool.h:183
CTxMemPool(CBlockPolicyEstimator *estimator=nullptr)
Create a new CTxMemPool.
Definition: txmempool.cpp:333
CAmount GetModFeesWithDescendants() const
Definition: txmempool.h:125
bool operator()(const txiter &a, const txiter &b) const
Definition: txmempool.h:495
bool HasNoInputsOf(const CTransaction &tx) const
Check that none of this transactions inputs are in the mempool, and thus the tx is not dependent on o...
Definition: txmempool.cpp:1363
uint64_t GetSizeWithDescendants() const
Definition: txmempool.h:124
std::set< txiter, CompareIteratorByHash > setEntries
Definition: txmempool.h:499
Definition: txmempool.h:323
void queryHashes(std::vector< uint256 > &vtxid)
Definition: txmempool.cpp:1180
void addTransaction(const CTransactionRef &tx)
Definition: txmempool.h:804
MemPoolRemovalReason
Reason why a transaction was removed from the mempool, this is passed to the notification signal...
Definition: txmempool.h:349
bool operator()(const CTxMemPoolEntry &a, const CTxMemPoolEntry &b) const
Definition: txmempool.h:215
Definition: txmempool.h:494
Definition: txmempool.h:173
void TrimToSize(size_t sizelimit, std::vector< COutPoint > *pvNoSpendsRemaining=nullptr)
Remove transactions from the mempool until its dynamic size is <= sizelimit.
Definition: txmempool.cpp:1502
void UpdateAncestorState(int64_t modifySize, CAmount modifyFee, int64_t modifyCount, int64_t modifySigOps)
Definition: txmempool.cpp:322
indirectmap< COutPoint, const CTransaction * > mapNextTx
Definition: txmempool.h:538
update_descendant_state(int64_t _modifySize, CAmount _modifyFee, int64_t _modifyCount)
Definition: txmempool.h:144
void UpdateTransactionsFromBlock(const std::vector< uint256 > &vHashesToUpdate)
When adding transactions from a disconnected block back to the mempool, new mempool entries may have ...
Definition: txmempool.cpp:111
CTxMemPoolEntry stores data about the corresponding transaction, as well as data about all in-mempool...
Definition: txmempool.h:69
void check(const CCoinsViewCache *pcoins) const
If sanity-checking is turned on, check makes sure the pool is consistent (does not contain two transa...
Definition: txmempool.cpp:1013
Definition: txmempool.h:157
void GetModFeeAndSize(const T &a, double &mod_fee, double &size) const
Definition: txmempool.h:304
boost::multi_index_container< CTransactionRef, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< boost::multi_index::tag< txid_index >, mempoolentry_txid, SaltedTxidHasher >, boost::multi_index::sequenced< boost::multi_index::tag< insertion_order > > > > indexed_disconnected_transactions
Definition: txmempool.h:783
unsigned int nSigOpCountWithAncestors
Definition: txmempool.h:94
std::map< CSpentIndexKey, CSpentIndexValue, CSpentIndexKeyCompare > mapSpentIndex
Definition: txmempool.h:520
std::map< COutPoint, uint256 > mapProTxCollaterals
Definition: txmempool.h:530
bool operator()(const T &a, const T &b) const
Definition: txmempool.h:285
bool blockSinceLastRollingFeeBump
Definition: txmempool.h:453
std::map< uint256, std::vector< CSpentIndexKey > > mapSpentIndexInserted
Definition: txmempool.h:523
Removed in size limiting.
indexed_disconnected_transactions queuedTx
Definition: txmempool.h:795
static const uint32_t MEMPOOL_HEIGHT
Fake height value used in Coin to signify they are only in the memory pool (since 0...
Definition: txmempool.h:38
result_type operator()(const CTxMemPoolEntry &entry) const
Definition: txmempool.h:197
std::vector< std::pair< uint256, txiter > > vTxHashes
All tx hashes/entries in mapTx, in random order.
Definition: txmempool.h:492
int64_t feeDelta
Used for determining the priority of the transaction for mining in a block.
Definition: txmempool.h:80
void ApplyDelta(const uint256 hash, CAmount &nFeeDelta) const
Definition: txmempool.cpp:1347
void removeForBlock(const std::vector< CTransactionRef > &vtx)
Definition: txmempool.h:811
bool removeAddressIndex(const uint256 txhash)
Definition: txmempool.cpp:539
We want to be able to estimate feerates that are needed on tx's to be included in a certain number of...
Definition: fees.h:138
Definition: bls.h:263
Removed for block.
std::vector< indexed_transaction_set::const_iterator > GetSortedDepthAndScore() const
Definition: txmempool.cpp:1166
Removed for reorganization.
void UpdateParent(txiter entry, txiter parent, bool add)
Definition: txmempool.cpp:1444
void CalculateDescendants(txiter it, setEntries &setDescendants)
Populate setDescendants with all in-mempool descendants of hash.
Definition: txmempool.cpp:702
unsigned int GetSigOpCountWithAncestors() const
Definition: txmempool.h:132
const setEntries & GetMemPoolChildren(txiter entry) const
Definition: txmempool.cpp:1462
void removeProTxSpentCollateralConflicts(const CTransaction &tx)
Definition: txmempool.cpp:841
uint64_t cachedInnerUsage
sum of dynamic memory usage of all the map elements (NOT the maps themselves)
Definition: txmempool.h:450
Sort an entry by max(score/size of entry's tx, score/size with all descendants).
Definition: txmempool.h:212
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) const
Try to calculate all in-mempool ancestors of entry.
Definition: txmempool.cpp:154
unsigned int nTransactionsUpdated
Used by getblocktemplate to trigger CreateNewBlock() invocation.
Definition: txmempool.h:446
Manually removed or unknown reason.
Definition: txmempool.h:766
std::map< CService, uint256 > mapProTxAddresses
Definition: txmempool.h:527
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:26
void AddTransactionsUpdated(unsigned int n)
Definition: txmempool.cpp:356
uint64_t GetCountWithDescendants() const
Definition: txmempool.h:123
CFeeRate GetMinFee(size_t sizelimit) const
The minimum fee to get into the mempool, which may itself not be enough for larger-sized transactions...
Definition: txmempool.cpp:1470
Definition: txmempool.h:768
indexed_transaction_set::nth_index< 0 >::type::iterator txiter
Definition: txmempool.h:491
bool removeSpentIndex(const uint256 txhash)
Definition: txmempool.cpp:608
static size_t MallocUsage(size_t alloc)
Compute the total memory used by allocating alloc bytes.
Definition: memusage.h:48
Definition: spentindex.h:42
bool TransactionWithinChainLimit(const uint256 &txid, size_t chainLimit) const
Returns false if the transaction is in the mempool and not within the chain limit specified...
Definition: txmempool.cpp:1545
uint64_t GetCountWithAncestors() const
Definition: txmempool.h:129
Definition: txmempool.h:322
Definition: indirectmap.h:22
void UpdateChildrenForRemoval(txiter entry)
Sever link between specified transaction and direct children.
Definition: txmempool.cpp:247
update_ancestor_state(int64_t _modifySize, CAmount _modifyFee, int64_t _modifyCount, int _modifySigOps)
Definition: txmempool.h:159
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Definition: txmempool.h:442
bool CompareDepthAndScore(const uint256 &hasha, const uint256 &hashb)
Definition: txmempool.cpp:1135
std::map< txiter, setEntries, CompareIteratorByHash > cacheMap
Definition: txmempool.h:504
The block chain is a tree shaped structure starting with the genesis block at the root...
Definition: chain.h:170
void UpdateDescendantState(int64_t modifySize, CAmount modifyFee, int64_t modifyCount)
Definition: txmempool.cpp:313
uint64_t SipHashUint256(uint64_t k0, uint64_t k1, const uint256 &val)
Optimized SipHash-2-4 implementation for uint256.
Definition: hash.cpp:168
boost::multi_index_container< CTxMemPoolEntry, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< mempoolentry_txid, SaltedTxidHasher >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< descendant_score >, boost::multi_index::identity< CTxMemPoolEntry >, CompareTxMemPoolEntryByDescendantScore >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< entry_time >, boost::multi_index::identity< CTxMemPoolEntry >, CompareTxMemPoolEntryByEntryTime >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< ancestor_score >, boost::multi_index::identity< CTxMemPoolEntry >, CompareTxMemPoolEntryByAncestorFee > > > indexed_transaction_set
Definition: txmempool.h:486
void UpdateForRemoveFromMempool(const setEntries &entriesToRemove, bool updateDescendants)
For each transaction being removed, update ancestors and any direct children.
Definition: txmempool.cpp:255
std::map< uint256, std::vector< CMempoolAddressDeltaKey > > addressDeltaMapInserted
Definition: txmempool.h:517
void removeProTxPubKeyConflicts(const CTransaction &tx, const CKeyID &keyId)
Definition: txmempool.cpp:811
Definition: spentindex.h:14
void UpdateChild(txiter entry, txiter child, bool add)
Definition: txmempool.cpp:1434
unsigned int GetTransactionsUpdated() const
Definition: txmempool.cpp:350
const setEntries & GetMemPoolParents(txiter entry) const
Definition: txmempool.cpp:1454
std::map< uint256, uint256 > mapProTxBlsPubKeyHashes
Definition: txmempool.h:529
static size_t RecursiveDynamicUsage(const CScript &script)
Definition: core_memusage.h:12
update_lock_points(const LockPoints &_lp)
Definition: txmempool.h:185
void ClearPrioritisation(const uint256 hash)
Definition: txmempool.cpp:1357
bool getSpentIndex(CSpentIndexKey &key, CSpentIndexValue &value)
Definition: txmempool.cpp:595
void UpdateAncestorsOf(bool add, txiter hash, setEntries &setAncestors)
Update ancestors of hash to add/remove it as a descendant transaction.
Definition: txmempool.cpp:218
boost::signals2::signal< void(CTransactionRef, MemPoolRemovalReason)> NotifyEntryRemoved
Definition: txmempool.h:687
bool addUnchecked(const uint256 &hash, const CTxMemPoolEntry &entry, bool validFeeEstimate=true)
Definition: txmempool.cpp:1424
void removeForBlock(const std::vector< CTransactionRef > &vtx, unsigned int nBlockHeight)
Called when a block is connected.
Definition: txmempool.cpp:953
CCoinsViewMemPool(CCoinsView *baseIn, const CTxMemPool &mempoolIn)
Definition: txmempool.cpp:1371
size_t DynamicMemoryUsage() const
Definition: txmempool.h:800
The basic transaction that is broadcasted on the network and contained in blocks. ...
Definition: transaction.h:198
CCoinsView that adds a memory cache for transactions to another CCoinsView.
Definition: coins.h:201
Sort by score of entry ((fee+delta)/size) in descending order.
Definition: txmempool.h:254
void removeProTxConflicts(const CTransaction &tx)
Definition: txmempool.cpp:895
void removeProTxCollateralConflicts(const CTransaction &tx, const COutPoint &collateralOutpoint)
Definition: txmempool.cpp:831
void addAddressIndex(const CTxMemPoolEntry &entry, const CCoinsViewCache &view)
Definition: txmempool.cpp:468
CBlockPolicyEstimator * minerPolicyEstimator
Definition: txmempool.h:447
void GetModFeeAndSize(const CTxMemPoolEntry &a, double &mod_fee, double &size) const
Definition: txmempool.h:233
double rollingMinimumFeeRate
minimum fee to get into the pool, decreases exponentially
Definition: txmempool.h:454
CCoinsView that brings transactions from a memorypool into view.
Definition: txmempool.h:739
void PrioritiseTransaction(const uint256 &hash, const CAmount &nFeeDelta)
Affect CreateNewBlock prioritisation of transactions.
Definition: txmempool.cpp:1317
void removeForReorg(const CCoinsViewCache *pcoins, unsigned int nMemPoolHeight, int flags)
Definition: txmempool.cpp:757
void removeEntry(indexed_disconnected_transactions::index< insertion_order >::type::iterator entry)
Definition: txmempool.h:827
void removeUnchecked(txiter entry, MemPoolRemovalReason reason=MemPoolRemovalReason::UNKNOWN)
Before calling removeUnchecked for a given transaction, UpdateForRemoveFromMempool must be called on ...
Definition: txmempool.cpp:624
std::map< CMempoolAddressDeltaKey, CMempoolAddressDelta, CMempoolAddressDeltaKeyCompare > addressDeltaMap
Definition: txmempool.h:514
bool operator()(const CTxMemPoolEntry &a, const CTxMemPoolEntry &b) const
Definition: txmempool.h:257
Wrapped mutex: supports recursive locking, but no waiting TODO: We should move away from using the re...
Definition: sync.h:94
void RemoveStaged(setEntries &stage, bool updateDescendants, MemPoolRemovalReason reason=MemPoolRemovalReason::UNKNOWN)
Remove a set of transactions from the mempool.
Definition: txmempool.cpp:1395
Definition: txmempool.h:268
Definition: txmempool.h:142
void UpdateForDescendants(txiter updateIt, cacheMap &cachedDescendants, const std::set< uint256 > &setExclude)
UpdateForDescendants is used by UpdateTransactionsFromBlock to update the descendants for a single tr...
Definition: txmempool.cpp:64