![]() |
PRCYCoin
2.0.0.7rc1
P2P Digital Currency
|
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the next block. More...
#include <txmempool.h>
Public Member Functions | |
| CTxMemPool (const CFeeRate &_minRelayFee) | |
| ~CTxMemPool () | |
| void | 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). More... | |
| void | setSanityCheck (bool _fSanityCheck) |
| bool | addUnchecked (const uint256 &hash, const CTxMemPoolEntry &entry) |
| void | remove (const CTransaction &tx, std::list< CTransaction > &removed, bool fRecursive=false) |
| void | removeCoinbaseSpends (const CCoinsViewCache *pcoins, unsigned int nMemPoolHeight) |
| void | removeConflicts (const CTransaction &tx, std::list< CTransaction > &removed) |
| void | removeForBlock (const std::vector< CTransaction > &vtx, unsigned int nBlockHeight, std::list< CTransaction > &conflicts) |
| Called when a block is connected. More... | |
| void | clear () |
| void | queryHashes (std::vector< uint256 > &vtxid) |
| void | pruneSpent (const uint256 &hash, CCoins &coins) |
| unsigned int | GetTransactionsUpdated () const |
| void | AddTransactionsUpdated (unsigned int n) |
| void | PrioritiseTransaction (const uint256 hash, const std::string strHash, double dPriorityDelta, const CAmount &nFeeDelta) |
| Affect CreateNewBlock prioritisation of transactions. More... | |
| void | ApplyDeltas (const uint256 hash, double &dPriorityDelta, CAmount &nFeeDelta) |
| void | ClearPrioritisation (const uint256 hash) |
| unsigned long | size () |
| uint64_t | GetTotalTxSize () |
| bool | exists (uint256 hash) |
| bool | lookup (uint256 hash, CTransaction &result) const |
| CFeeRate | estimateFee (int nBlocks) const |
| Estimate fee rate needed to get into the next nBlocks. More... | |
| double | estimatePriority (int nBlocks) const |
| Estimate priority needed to get into the next nBlocks. More... | |
| bool | WriteFeeEstimates (CAutoFile &fileout) const |
| Write/Read estimates to disk. More... | |
| bool | ReadFeeEstimates (CAutoFile &filein) |
Public Attributes | |
| RecursiveMutex | cs |
| sum of all mempool tx' byte sizes More... | |
| std::map< uint256, CTxMemPoolEntry > | mapTx |
| std::map< COutPoint, CInPoint > | mapNextTx |
| std::map< uint256, std::pair< double, CAmount > > | mapDeltas |
Private Attributes | |
| bool | fSanityCheck |
| unsigned int | nTransactionsUpdated |
| Normally false, true if -checkmempool or -regtest. More... | |
| CMinerPolicyEstimator * | minerPolicyEstimator |
| CFeeRate | minRelayFee |
| uint64_t | totalTxSize |
| Passed to constructor to avoid dependency on main. More... | |
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.
Definition at line 97 of file txmempool.h.
| CTxMemPool::CTxMemPool | ( | const CFeeRate & | _minRelayFee | ) |
Definition at line 355 of file txmempool.cpp.
| CTxMemPool::~CTxMemPool | ( | ) |
Definition at line 371 of file txmempool.cpp.
| void CTxMemPool::AddTransactionsUpdated | ( | unsigned int | n | ) |
| bool CTxMemPool::addUnchecked | ( | const uint256 & | hash, |
| const CTxMemPoolEntry & | entry | ||
| ) |
| 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 540 of file txmempool.cpp.
| void CTxMemPool::clear | ( | ) |
| void CTxMemPool::ClearPrioritisation | ( | const uint256 | hash | ) |
| CFeeRate CTxMemPool::estimateFee | ( | int | nBlocks | ) | const |
Estimate fee rate needed to get into the next nBlocks.
Definition at line 633 of file txmempool.cpp.
| double CTxMemPool::estimatePriority | ( | int | nBlocks | ) | const |
Estimate priority needed to get into the next nBlocks.
Definition at line 638 of file txmempool.cpp.
|
inline |
|
inline |
Definition at line 173 of file txmempool.h.
| unsigned int CTxMemPool::GetTransactionsUpdated | ( | ) | const |
Definition at line 389 of file txmempool.cpp.
| bool CTxMemPool::lookup | ( | uint256 | hash, |
| CTransaction & | result | ||
| ) | const |
| void CTxMemPool::PrioritiseTransaction | ( | const uint256 | hash, |
| const std::string | strHash, | ||
| double | dPriorityDelta, | ||
| const CAmount & | nFeeDelta | ||
| ) |
Affect CreateNewBlock prioritisation of transactions.
Definition at line 675 of file txmempool.cpp.
Definition at line 376 of file txmempool.cpp.
| void CTxMemPool::queryHashes | ( | std::vector< uint256 > & | vtxid | ) |
Definition at line 614 of file txmempool.cpp.
| bool CTxMemPool::ReadFeeEstimates | ( | CAutoFile & | filein | ) |
Definition at line 658 of file txmempool.cpp.
| void CTxMemPool::remove | ( | const CTransaction & | tx, |
| std::list< CTransaction > & | removed, | ||
| bool | fRecursive = false |
||
| ) |
Definition at line 424 of file txmempool.cpp.
| void CTxMemPool::removeCoinbaseSpends | ( | const CCoinsViewCache * | pcoins, |
| unsigned int | nMemPoolHeight | ||
| ) |
| void CTxMemPool::removeConflicts | ( | const CTransaction & | tx, |
| std::list< CTransaction > & | removed | ||
| ) |
Definition at line 493 of file txmempool.cpp.
| void CTxMemPool::removeForBlock | ( | const std::vector< CTransaction > & | vtx, |
| unsigned int | nBlockHeight, | ||
| std::list< CTransaction > & | conflicts | ||
| ) |
Called when a block is connected.
Removes from mempool and updates the miner fee estimator.
Definition at line 512 of file txmempool.cpp.
|
inline |
Definition at line 150 of file txmempool.h.
|
inline |
Definition at line 168 of file txmempool.h.
| bool CTxMemPool::WriteFeeEstimates | ( | CAutoFile & | fileout | ) | const |
Write/Read estimates to disk.
Definition at line 644 of file txmempool.cpp.
|
mutable |
sum of all mempool tx' byte sizes
This mutex needs to be locked when accessing mapTx or other members that are guarded by it.
By design, it is guaranteed that:
cs_main and mempool.cs will give a view of mempool that is consistent with current chain tip (::ChainActive() and CoinsTip()) and is fully populated. Fully populated means that if the current active chain is missing transactions that were present in a previously active chain, all the missing transactions will have been re-added to the mempool and should be present if they meet size and consistency constraints.mempool.cs without cs_main will give a view of a mempool consistent with some chain that was active since cs_main was last locked, and that is fully populated as described above. It is ok for code that only needs to query or remove transactions from the mempool to lock just mempool.cs without cs_main.To provide these guarantees, it is necessary to lock both cs_main and mempool.cs whenever adding transactions to the mempool and whenever changing the chain tip. It's necessary to keep both mutexes locked until the mempool is consistent with the new chain tip and fully populated.
Definition at line 135 of file txmempool.h.
|
private |
Definition at line 100 of file txmempool.h.
Definition at line 138 of file txmempool.h.
Definition at line 137 of file txmempool.h.
| std::map<uint256, CTxMemPoolEntry> CTxMemPool::mapTx |
Definition at line 136 of file txmempool.h.
|
private |
Definition at line 102 of file txmempool.h.
|
private |
Definition at line 104 of file txmempool.h.
|
private |
Normally false, true if -checkmempool or -regtest.
Definition at line 101 of file txmempool.h.
|
private |
Passed to constructor to avoid dependency on main.
Definition at line 105 of file txmempool.h.
1.8.17