Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.h
Show All 38 Lines | |||||
* pool(since 0.8) | * pool(since 0.8) | ||||
*/ | */ | ||||
static const uint32_t MEMPOOL_HEIGHT = 0x7FFFFFFF; | static const uint32_t MEMPOOL_HEIGHT = 0x7FFFFFFF; | ||||
struct LockPoints { | struct LockPoints { | ||||
// Will be set to the blockchain height and median time past values that | // Will be set to the blockchain height and median time past values that | ||||
// would be necessary to satisfy all relative locktime constraints (BIP68) | // would be necessary to satisfy all relative locktime constraints (BIP68) | ||||
// of this tx given our view of block chain history | // of this tx given our view of block chain history | ||||
int height; | int height{0}; | ||||
int64_t time; | int64_t time{0}; | ||||
// As long as the current chain descends from the highest height block | // As long as the current chain descends from the highest height block | ||||
// containing one of the inputs used in the calculation, then the cached | // containing one of the inputs used in the calculation, then the cached | ||||
// values are still valid even after a reorg. | // values are still valid even after a reorg. | ||||
CBlockIndex *maxInputBlock; | CBlockIndex *maxInputBlock{nullptr}; | ||||
LockPoints() : height(0), time(0), maxInputBlock(nullptr) {} | |||||
}; | }; | ||||
struct CompareIteratorById { | struct CompareIteratorById { | ||||
// SFINAE for T where T is either a pointer type (e.g., a txiter) or a | // SFINAE for T where T is either a pointer type (e.g., a txiter) or a | ||||
// reference_wrapper<T> (e.g. a wrapped CTxMemPoolEntry&) | // reference_wrapper<T> (e.g. a wrapped CTxMemPoolEntry&) | ||||
template <typename T> | template <typename T> | ||||
bool operator()(const std::reference_wrapper<T> &a, | bool operator()(const std::reference_wrapper<T> &a, | ||||
const std::reference_wrapper<T> &b) const { | const std::reference_wrapper<T> &b) const { | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | private: | ||||
* Total sigop plus P2SH sigops count. | * Total sigop plus P2SH sigops count. | ||||
* After the sigchecks activation we repurpose the 'sigops' tracking in | * After the sigchecks activation we repurpose the 'sigops' tracking in | ||||
* mempool/mining to actually track sigchecks instead. (Proper SigOps will | * mempool/mining to actually track sigchecks instead. (Proper SigOps will | ||||
* not need to be counted any more since it's getting deactivated.) | * not need to be counted any more since it's getting deactivated.) | ||||
*/ | */ | ||||
const int64_t sigOpCount; | const int64_t sigOpCount; | ||||
//! Used for determining the priority of the transaction for mining in a | //! Used for determining the priority of the transaction for mining in a | ||||
//! block | //! block | ||||
Amount feeDelta; | Amount feeDelta{Amount::zero()}; | ||||
//! Track the height and time at which tx was final | //! Track the height and time at which tx was final | ||||
LockPoints lockPoints; | LockPoints lockPoints; | ||||
// Information about descendants of this transaction that are in the | // Information about descendants of this transaction that are in the | ||||
// mempool; if we remove this transaction we must remove all of these | // mempool; if we remove this transaction we must remove all of these | ||||
// descendants as well. | // descendants as well. | ||||
//! number of descendant transactions | //! number of descendant transactions | ||||
uint64_t nCountWithDescendants; | uint64_t nCountWithDescendants{1}; | ||||
//! ... and size | //! ... and size | ||||
uint64_t nSizeWithDescendants; | uint64_t nSizeWithDescendants; | ||||
//! ... and total fees (all including us) | //! ... and total fees (all including us) | ||||
Amount nModFeesWithDescendants; | Amount nModFeesWithDescendants; | ||||
//! ... and sigop count | //! ... and sigop count | ||||
int64_t nSigOpCountWithDescendants; | int64_t nSigOpCountWithDescendants; | ||||
// Analogous statistics for ancestor transactions | // Analogous statistics for ancestor transactions | ||||
uint64_t nCountWithAncestors; | uint64_t nCountWithAncestors{1}; | ||||
uint64_t nSizeWithAncestors; | uint64_t nSizeWithAncestors; | ||||
Amount nModFeesWithAncestors; | Amount nModFeesWithAncestors; | ||||
int64_t nSigOpCountWithAncestors; | int64_t nSigOpCountWithAncestors; | ||||
public: | public: | ||||
CTxMemPoolEntry(const CTransactionRef &_tx, const Amount _nFee, | CTxMemPoolEntry(const CTransactionRef &_tx, const Amount fee, int64_t time, | ||||
int64_t _nTime, unsigned int _entryHeight, | unsigned int entry_height, bool spends_coinbase, | ||||
bool spendsCoinbase, int64_t _nSigOpCount, LockPoints lp); | int64_t sigops_count, LockPoints lp); | ||||
const CTransaction &GetTx() const { return *this->tx; } | const CTransaction &GetTx() const { return *this->tx; } | ||||
CTransactionRef GetSharedTx() const { return this->tx; } | CTransactionRef GetSharedTx() const { return this->tx; } | ||||
const Amount GetFee() const { return nFee; } | const Amount GetFee() const { return nFee; } | ||||
size_t GetTxSize() const { return nTxSize; } | size_t GetTxSize() const { return nTxSize; } | ||||
size_t GetTxVirtualSize() const; | size_t GetTxVirtualSize() const; | ||||
std::chrono::seconds GetTime() const { return std::chrono::seconds{nTime}; } | std::chrono::seconds GetTime() const { return std::chrono::seconds{nTime}; } | ||||
▲ Show 20 Lines • Show All 944 Lines • Show Last 20 Lines |