5#ifndef BITCOIN_KERNEL_MEMPOOL_ENTRY_H
6#define BITCOIN_KERNEL_MEMPOOL_ENTRY_H
35 const std::reference_wrapper<T> &
b)
const {
36 return a.get()->GetTx().GetId() <
b.get()->GetTx().GetId();
38 template <
typename T>
bool operator()(
const T &
a,
const T &
b)
const {
39 return (*a)->GetTx().GetId() < (*b)->GetTx().GetId();
46 const std::reference_wrapper<T> &
b)
const {
47 return a.get()->GetEntryId() >
b.get()->GetEntryId();
50 template <
typename T>
bool operator()(
const T &
a,
const T &
b)
const {
51 return (*a)->GetEntryId() > (*b)->GetEntryId();
68 typedef std::set<std::reference_wrapper<const CTxMemPoolEntryRef>,
71 typedef std::set<std::reference_wrapper<const CTxMemPoolEntryRef>,
119 refcount(other.refcount.load()){};
126 const CTransaction &
GetTx()
const {
return *this->
tx; }
135 std::chrono::seconds
GetTime()
const {
return std::chrono::seconds{
nTime}; }
Fee rate in satoshis per kilobyte: Amount / kB.
CTxMemPoolEntry stores data about the corresponding transaction, as well as data about all in-mempool...
const LockPoints & GetLockPoints() const
unsigned int GetHeight() const
std::chrono::seconds GetTime() const
const CTransaction & GetTx() const
Children & GetMemPoolChildren() const
IMPLEMENT_RCU_REFCOUNT(uint64_t)
uint64_t GetEntryId() const
const int64_t nTime
Local time when entering the mempool.
const Amount nFee
Cached to avoid expensive parent-transaction lookups.
const size_t nTxSize
... and avoid recomputing tx size
const size_t nUsageSize
... and total memory usage
CTxMemPoolEntry(const CTransactionRef &_tx, const Amount fee, int64_t time, unsigned int entry_height, int64_t sigchecks, LockPoints lp)
int64_t GetSigChecks() const
void SetEntryId(uint64_t eid)
This should only be set by addUnchecked() before entry insertion into mempool.
std::set< std::reference_wrapper< const CTxMemPoolEntryRef >, CompareIteratorById > Children
const Children & GetMemPoolChildrenConst() const
CTxMemPoolEntry(const CTxMemPoolEntry &other)=delete
Amount feeDelta
Used for determining the priority of the transaction for mining in a block.
CTxMemPoolEntry(CTxMemPoolEntry &&other)
CTransactionRef GetSharedTx() const
Amount GetModifiedFee() const
const Parents & GetMemPoolParentsConst() const
CFeeRate GetModifiedFeeRate() const
size_t DynamicMemoryUsage() const
void UpdateFeeDelta(Amount newFeeDelta)
size_t GetTxVirtualSize() const
Parents & GetMemPoolParents() const
uint64_t entryId
Unique identifier – used for topological sorting.
LockPoints lockPoints
Track the height and time at which tx was final.
const unsigned int entryHeight
Chain height when entering the mempool.
std::set< std::reference_wrapper< const CTxMemPoolEntryRef >, CompareIteratorById > Parents
const int64_t sigChecks
Total sigChecks.
static size_t RecursiveDynamicUsage(const CScript &script)
Implement std::hash so RCUPtr can be used as a key for maps or sets.
uint32_t nBytesPerSigCheck
int64_t GetVirtualTransactionSize(int64_t nSize, int64_t nSigChecks, unsigned int bytes_per_sigCheck)
Compute the virtual transaction size (size, or more if sigChecks are too dense).
std::shared_ptr< const CTransaction > CTransactionRef
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
static constexpr Amount zero() noexcept
bool operator()(const std::reference_wrapper< T > &a, const std::reference_wrapper< T > &b) const
bool operator()(const T &a, const T &b) const
Iterate txs in reverse-topological order.
bool operator()(const std::reference_wrapper< T > &a, const std::reference_wrapper< T > &b) const
bool operator()(const T &a, const T &b) const