Bitcoin Core 32.1.0
P2P Digital Currency
Loading...
Searching...
No Matches
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
MemPoolFeeRateEstimatorCache & operator= (const MemPoolFeeRateEstimatorCache &)=delete
bool IsStale () const
 Returns true if the cache is empty or older than CACHE_LIFE.
std::optional< FeeRateEstimate > GetCachedEstimate (const uint256 &tip_hash) const
 Returns cached estimates if not stale and computed on tip_hash, nullopt otherwise.
void Update (FeePerVSize conservative, FeePerVSize economical, const uint256 &tip_hash)
 Update the cache with new estimates computed on tip_hash.
void Clear ()
 Clear cached fee rate estimates.

Private Attributes

std::optional< FeeRateEstimate > m_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
Here is the caller graph for this function:

◆ MemPoolFeeRateEstimatorCache() [2/2]

MemPoolFeeRateEstimatorCache::MemPoolFeeRateEstimatorCache ( const MemPoolFeeRateEstimatorCache & )
delete
Here is the call graph for this function:

Member Function Documentation

◆ Clear()

void MemPoolFeeRateEstimatorCache::Clear ( )

Clear cached fee rate estimates.

Definition at line 136 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 123 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 117 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
Here is the call graph for this function:

◆ 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 129 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: