![]() |
Bitcoin Core 32.99.0
P2P Digital Currency
|
Manages fee rate estimators. More...
#include <estimator_man.h>
Public Member Functions | |
| FeeRateEstimatorManager (const fs::path &block_policy_path, bool read_stale_estimates, const fs::path &mempool_estimator_path, const CTxMemPool &mempool, ChainstateManager &chainman) | |
| virtual | ~FeeRateEstimatorManager () |
| virtual util::Expected< FeeRateEstimation, FeeRateEstimationError > | GetFeeRateEstimate (int target, bool conservative) const |
| Get a combined fee rate estimate from the available fee rate estimators. More... | |
| virtual util::Expected< FeeRateEstimation, FeeRateEstimationError > | GetFeeRateEstimate (FeeRateEstimatorType type, int target, bool conservative) const |
| Like GetFeeRateEstimate, but only consults the specified estimator type. More... | |
| void | IntervalFlush () |
| Flush recorded data to disk. More... | |
| void | ShutdownFlush () |
| Flush recorded data to disk as part of shutdown sequence. More... | |
| void | MempoolLoadFailed () |
| Called when the mempool was not loaded from disk (the load failed, there was no mempool file, or -persistmempool=0), unless loading was interrupted by shutdown. More... | |
| virtual unsigned int | MaximumTarget () const |
| Returns the maximum supported confirmation target from all fee rate estimators. More... | |
| CFeeRate | BlockPolicyEstimateRawFee (unsigned int target, double threshold, FeeEstimateHorizon horizon, EstimationResult *buckets) const |
| Delegate to the block policy estimator's estimateRawFee (used by the estimaterawfee RPC). More... | |
| unsigned int | BlockPolicyHighestTargetTracked (FeeEstimateHorizon horizon) const |
| Returns the maximum supported confirmation target of block policy estimator. More... | |
| std::vector< MinedBlockStats > | MempoolPolicyEstimatorBlocksStats () const |
| Returns per-block weight statistics for the last MEMPOOL_HEALTH_WINDOW_BLOCKS mined blocks. More... | |
Protected Member Functions | |
| void | TransactionAddedToMempool (const NewMempoolTransactionInfo &tx, uint64_t) override |
| Overridden from CValidationInterface. More... | |
| void | TransactionRemovedFromMempool (const CTransactionRef &tx, MemPoolRemovalReason, uint64_t) override |
| Notifies listeners of a transaction leaving mempool. More... | |
| void | MempoolTransactionsRemovedForBlock (const std::shared_ptr< const CBlock > &block, const std::vector< RemovedMempoolTransactionInfo > &txs_removed_for_block, unsigned int block_height) override |
Protected Member Functions inherited from CValidationInterface | |
| ~CValidationInterface ()=default | |
| Protected destructor so that instances can only be deleted by derived classes. More... | |
| virtual void | UpdatedBlockTip (const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) |
| Notifies listeners when the block chain tip advances. More... | |
| virtual void | ActiveTipChange (const CBlockIndex &new_tip, bool is_ibd) |
| Notifies listeners any time the block chain tip changes, synchronously. More... | |
| virtual void | TransactionAddedToMempool (const NewMempoolTransactionInfo &tx, uint64_t mempool_sequence) |
| Notifies listeners of a transaction having been added to mempool. More... | |
| virtual void | TransactionRemovedFromMempool (const CTransactionRef &tx, MemPoolRemovalReason reason, uint64_t mempool_sequence) |
| Notifies listeners of a transaction leaving mempool. More... | |
| virtual void | MempoolTransactionsRemovedForBlock (const std::shared_ptr< const CBlock > &block, const std::vector< RemovedMempoolTransactionInfo > &txs_removed_for_block, unsigned int block_height) |
| virtual void | BlockConnected (const kernel::ChainstateRole &role, const std::shared_ptr< const CBlock > &block, const CBlockIndex *pindex) |
| Notifies listeners of a block being connected. More... | |
| virtual void | BlockDisconnected (const std::shared_ptr< const CBlock > &block, const CBlockIndex *pindex) |
| Notifies listeners of a block being disconnected Provides the block that was disconnected. More... | |
| virtual void | ChainStateFlushed (const kernel::ChainstateRole &role, const CBlockLocator &locator) |
| Notifies listeners of the new active block chain on-disk. More... | |
| virtual void | BlockChecked (const std::shared_ptr< const CBlock > &, const BlockValidationState &) |
| Notifies listeners of a block validation result. More... | |
| virtual void | NewPoWValidBlock (const CBlockIndex *pindex, const std::shared_ptr< const CBlock > &block) |
| Notifies listeners that a block which builds directly on our current tip has been received and connected to the headers tree, though not validated yet. More... | |
Private Attributes | |
| std::unique_ptr< CBlockPolicyEstimator > | m_block_policy_estimator |
| std::unique_ptr< MemPoolFeeRateEstimator > | m_mempool_estimator |
Manages fee rate estimators.
Definition at line 30 of file estimator_man.h.
| FeeRateEstimatorManager::FeeRateEstimatorManager | ( | const fs::path & | block_policy_path, |
| bool | read_stale_estimates, | ||
| const fs::path & | mempool_estimator_path, | ||
| const CTxMemPool & | mempool, | ||
| ChainstateManager & | chainman | ||
| ) |
| [in] | block_policy_path | Path to the block policy fee estimates file. |
| [in] | read_stale_estimates | Whether to load stale estimates from disk. |
| [in] | mempool_estimator_path | Path to the mempool policy estimator data file. |
| [in] | mempool | The mempool to use for the mempool fee rate estimator. |
| [in] | chainman | The chainstate manager. |
Definition at line 15 of file estimator_man.cpp.
|
virtualdefault |
| CFeeRate FeeRateEstimatorManager::BlockPolicyEstimateRawFee | ( | unsigned int | target, |
| double | threshold, | ||
| FeeEstimateHorizon | horizon, | ||
| EstimationResult * | buckets | ||
| ) | const |
Delegate to the block policy estimator's estimateRawFee (used by the estimaterawfee RPC).
Definition at line 95 of file estimator_man.cpp.
| unsigned int FeeRateEstimatorManager::BlockPolicyHighestTargetTracked | ( | FeeEstimateHorizon | horizon | ) | const |
Returns the maximum supported confirmation target of block policy estimator.
Definition at line 100 of file estimator_man.cpp.
|
virtual |
Like GetFeeRateEstimate, but only consults the specified estimator type.
| [in] | type | The estimator to query. AUTO returns the manager-selected combined estimate. |
| [in] | target | The target within which the transaction should be confirmed. |
| [in] | conservative | Whether to select a more conservative, potentially higher, fee rate estimate. |
Definition at line 44 of file estimator_man.cpp.
|
virtual |
Get a combined fee rate estimate from the available fee rate estimators.
Combines both estimators, returning the lower of the block policy and mempool fee rate estimates. If the mempool fee rate estimator cannot produce an estimate, the block policy fee rate estimate is returned instead. An error is returned only if the block policy fee rate estimate is unavailable.
| [in] | target | The target within which the transaction should be confirmed. |
| [in] | conservative | Whether to select a more conservative, potentially higher, fee rate estimate. |
Definition at line 25 of file estimator_man.cpp.
| void FeeRateEstimatorManager::IntervalFlush | ( | ) |
Flush recorded data to disk.
Definition at line 57 of file estimator_man.cpp.
|
virtual |
Returns the maximum supported confirmation target from all fee rate estimators.
Definition at line 105 of file estimator_man.cpp.
| void FeeRateEstimatorManager::MempoolLoadFailed | ( | ) |
Called when the mempool was not loaded from disk (the load failed, there was no mempool file, or -persistmempool=0), unless loading was interrupted by shutdown.
Definition at line 69 of file estimator_man.cpp.
| std::vector< MinedBlockStats > FeeRateEstimatorManager::MempoolPolicyEstimatorBlocksStats | ( | ) | const |
Returns per-block weight statistics for the last MEMPOOL_HEALTH_WINDOW_BLOCKS mined blocks.
Definition at line 74 of file estimator_man.cpp.
|
overrideprotectedvirtual |
Reimplemented from CValidationInterface.
Definition at line 89 of file estimator_man.cpp.
| void FeeRateEstimatorManager::ShutdownFlush | ( | ) |
Flush recorded data to disk as part of shutdown sequence.
Definition at line 63 of file estimator_man.cpp.
|
overrideprotectedvirtual |
Overridden from CValidationInterface.
Reimplemented from CValidationInterface.
Definition at line 79 of file estimator_man.cpp.
|
overrideprotectedvirtual |
Notifies listeners of a transaction leaving mempool.
This notification fires for transactions that are removed from the mempool for the following reasons:
This does not fire for transactions that are removed from the mempool because they have been included in a block. Any client that is interested in transactions removed from the mempool for inclusion in a block can learn about those transactions from the MempoolTransactionsRemovedForBlock notification.
Transactions that are removed from the mempool because they conflict with a transaction in the new block will have TransactionRemovedFromMempool events fired before the BlockConnected event is fired. If multiple blocks are connected in one step, then the ordering could be:
Called on a background thread.
Reimplemented from CValidationInterface.
Definition at line 84 of file estimator_man.cpp.
|
private |
Definition at line 108 of file estimator_man.h.
|
private |
Definition at line 109 of file estimator_man.h.