mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-17 21:32:00 +01:00
fees: add ForecasterMan
class
- Its a module for managing and utilising multiple fee rate forecasters to provide fee rate forecast. - The ForecasterManager class allows for the registration of multiple fee rate forecasters. Co-authored-by: willcl-ark <will@256k1.dev>
This commit is contained in:
parent
0745dd789b
commit
df16b70a71
@ -259,6 +259,7 @@ add_library(bitcoin_node STATIC EXCLUDE_FROM_ALL
|
||||
policy/ephemeral_policy.cpp
|
||||
policy/fees.cpp
|
||||
policy/fees_args.cpp
|
||||
policy/fees/forecaster_man.cpp
|
||||
policy/packages.cpp
|
||||
policy/rbf.cpp
|
||||
policy/settings.cpp
|
||||
|
14
src/policy/fees/forecaster_man.cpp
Normal file
14
src/policy/fees/forecaster_man.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright (c) 2025 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license. See the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <policy/fees/forecaster.h>
|
||||
#include <policy/fees/forecaster_man.h>
|
||||
#include <policy/fees/forecaster_util.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
void FeeRateForecasterManager::RegisterForecaster(std::shared_ptr<Forecaster> forecaster)
|
||||
{
|
||||
forecasters.emplace(forecaster->GetForecastType(), forecaster);
|
||||
}
|
37
src/policy/fees/forecaster_man.h
Normal file
37
src/policy/fees/forecaster_man.h
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright (c) 2025 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license. See the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_POLICY_FEES_FORECASTER_MAN_H
|
||||
#define BITCOIN_POLICY_FEES_FORECASTER_MAN_H
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
class Forecaster;
|
||||
class ForecastResult;
|
||||
|
||||
enum class ForecastType;
|
||||
|
||||
/** \class FeeRateForecasterManager
|
||||
* Module for managing and utilising multiple fee rate forecasters to provide a forecast for a target.
|
||||
*
|
||||
* The FeeRateForecasterManager class allows for the registration of multiple fee rate
|
||||
* forecasters.
|
||||
*/
|
||||
class FeeRateForecasterManager
|
||||
{
|
||||
private:
|
||||
//! Map of all registered forecasters to their shared pointers.
|
||||
std::unordered_map<ForecastType, std::shared_ptr<Forecaster>> forecasters;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Register a forecaster to provide fee rate estimates.
|
||||
*
|
||||
* @param[in] forecaster shared pointer to a Forecaster instance.
|
||||
*/
|
||||
void RegisterForecaster(std::shared_ptr<Forecaster> forecaster);
|
||||
};
|
||||
|
||||
#endif // BITCOIN_POLICY_FEES_FORECASTER_MAN_H
|
Loading…
x
Reference in New Issue
Block a user