Bitcoin Core 31.99.0
P2P Digital Currency
Classes | Public Member Functions | Private Attributes | List of all members
MemPoolFeeRateEstimatorCache Class Reference

MemPoolFeeRateEstimatorCache holds a cache of recent fee rate estimates. More...

#include <mempool_estimator.h>

Collaboration diagram for MemPoolFeeRateEstimatorCache:
[legend]

Classes

struct  FeeRateEstimate
 

Public Member Functions

 MemPoolFeeRateEstimatorCache ()=default
 
 MemPoolFeeRateEstimatorCache (const MemPoolFeeRateEstimatorCache &)=delete
 
MemPoolFeeRateEstimatorCacheoperator= (const MemPoolFeeRateEstimatorCache &)=delete
 
bool IsStale () const
 Returns true if the cache is empty or older than CACHE_LIFE. More...
 
std::optional< FeeRateEstimateGetCachedEstimate (const uint256 &tip_hash) const
 Returns cached estimates if not stale and computed on tip_hash, nullopt otherwise. More...
 
void Update (FeePerVSize conservative, FeePerVSize economical, const uint256 &tip_hash)
 Update the cache with new estimates computed on tip_hash. More...
 
void Clear ()
 Clear cached fee rate estimates. More...
 

Private Attributes

std::optional< FeeRateEstimatem_fee_rate_estimation
 
uint256 m_tip_hash
 
NodeClock::time_point m_last_updated {}
 

Detailed Description

MemPoolFeeRateEstimatorCache holds a cache of recent fee rate estimates.

A cached fee rate is only provided while it is not older than CACHE_LIFE and the chain tip has not changed.

Definition at line 55 of file mempool_estimator.h.

Constructor & Destructor Documentation

◆ MemPoolFeeRateEstimatorCache() [1/2]

MemPoolFeeRateEstimatorCache::MemPoolFeeRateEstimatorCache ( )
default

◆ MemPoolFeeRateEstimatorCache() [2/2]

MemPoolFeeRateEstimatorCache::MemPoolFeeRateEstimatorCache ( const MemPoolFeeRateEstimatorCache )
delete

Member Function Documentation

◆ Clear()

void MemPoolFeeRateEstimatorCache::Clear ( )

Clear cached fee rate estimates.

Definition at line 135 of file mempool_estimator.cpp.

Here is the call graph for this function:

◆ GetCachedEstimate()

std::optional< MemPoolFeeRateEstimatorCache::FeeRateEstimate > MemPoolFeeRateEstimatorCache::GetCachedEstimate ( const uint256 tip_hash) const

Returns cached estimates if not stale and computed on tip_hash, nullopt otherwise.

Definition at line 122 of file mempool_estimator.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsStale()

bool MemPoolFeeRateEstimatorCache::IsStale ( ) const

Returns true if the cache is empty or older than CACHE_LIFE.

Definition at line 116 of file mempool_estimator.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

MemPoolFeeRateEstimatorCache & MemPoolFeeRateEstimatorCache::operator= ( const MemPoolFeeRateEstimatorCache )
delete

◆ Update()

void MemPoolFeeRateEstimatorCache::Update ( FeePerVSize  conservative,
FeePerVSize  economical,
const uint256 tip_hash 
)

Update the cache with new estimates computed on tip_hash.

Definition at line 128 of file mempool_estimator.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_fee_rate_estimation

std::optional<FeeRateEstimate> MemPoolFeeRateEstimatorCache::m_fee_rate_estimation
private

Definition at line 75 of file mempool_estimator.h.

◆ m_last_updated

NodeClock::time_point MemPoolFeeRateEstimatorCache::m_last_updated {}
private

Definition at line 77 of file mempool_estimator.h.

◆ m_tip_hash

uint256 MemPoolFeeRateEstimatorCache::m_tip_hash
private

Definition at line 76 of file mempool_estimator.h.


The documentation for this class was generated from the following files: