diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 89fdd855a45..e06f0dd0693 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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 diff --git a/src/policy/fees/forecaster_man.cpp b/src/policy/fees/forecaster_man.cpp new file mode 100644 index 00000000000..462fb2c8026 --- /dev/null +++ b/src/policy/fees/forecaster_man.cpp @@ -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 +#include +#include + +#include + +void FeeRateForecasterManager::RegisterForecaster(std::shared_ptr forecaster) +{ + forecasters.emplace(forecaster->GetForecastType(), forecaster); +} diff --git a/src/policy/fees/forecaster_man.h b/src/policy/fees/forecaster_man.h new file mode 100644 index 00000000000..13784e0e0a3 --- /dev/null +++ b/src/policy/fees/forecaster_man.h @@ -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 +#include + +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> 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); +}; + +#endif // BITCOIN_POLICY_FEES_FORECASTER_MAN_H