From 03bfeee957ab7e3b6aece82b9561774648094f54 Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Tue, 1 Dec 2020 11:24:33 +0100 Subject: interface: remove unused estimateSmartFee method from node Co-Authored-by: MarcoFalke Signed-off-by: Antoine Poinsot --- src/node/interfaces.cpp | 9 --------- 1 file changed, 9 deletions(-) (limited to 'src/node') diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp index a8c8be05fb..02c5cbc6b1 100644 --- a/src/node/interfaces.cpp +++ b/src/node/interfaces.cpp @@ -221,15 +221,6 @@ public: } } bool getNetworkActive() override { return m_context->connman && m_context->connman->GetNetworkActive(); } - CFeeRate estimateSmartFee(int num_blocks, bool conservative, int* returned_target = nullptr) override - { - FeeCalculation fee_calc; - CFeeRate result = ::feeEstimator.estimateSmartFee(num_blocks, &fee_calc, conservative); - if (returned_target) { - *returned_target = fee_calc.returnedTarget; - } - return result; - } CFeeRate getDustRelayFee() override { return ::dustRelayFee; } UniValue executeRpc(const std::string& command, const UniValue& params, const std::string& uri) override { -- cgit v1.2.3 From 86ff2cf202bfb9d9b50800b8ffe3fead3f77f5fa Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Tue, 28 Jul 2020 19:12:50 +0200 Subject: Remove the remaining fee estimation globals This moves the CBlockPolicyEstimator to the NodeContext, which get rids of two globals and allows us to conditionally create the CBlockPolicyEstimator (and to remove a circular dep). Signed-off-by: Antoine Poinsot --- src/node/context.cpp | 1 + src/node/context.h | 2 ++ src/node/interfaces.cpp | 6 ++++-- 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src/node') diff --git a/src/node/context.cpp b/src/node/context.cpp index 49d0c37235..958221a913 100644 --- a/src/node/context.cpp +++ b/src/node/context.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include diff --git a/src/node/context.h b/src/node/context.h index 3228831ed1..9b611bf8f5 100644 --- a/src/node/context.h +++ b/src/node/context.h @@ -12,6 +12,7 @@ class ArgsManager; class BanMan; +class CBlockPolicyEstimator; class CConnman; class CScheduler; class CTxMemPool; @@ -36,6 +37,7 @@ class WalletClient; struct NodeContext { std::unique_ptr connman; std::unique_ptr mempool; + std::unique_ptr fee_estimator; std::unique_ptr peerman; ChainstateManager* chainman{nullptr}; // Currently a raw pointer because the memory is not managed by this struct std::unique_ptr banman; diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp index 02c5cbc6b1..da3e759e38 100644 --- a/src/node/interfaces.cpp +++ b/src/node/interfaces.cpp @@ -592,11 +592,13 @@ public: } CFeeRate estimateSmartFee(int num_blocks, bool conservative, FeeCalculation* calc) override { - return ::feeEstimator.estimateSmartFee(num_blocks, calc, conservative); + if (!m_node.fee_estimator) return {}; + return m_node.fee_estimator->estimateSmartFee(num_blocks, calc, conservative); } unsigned int estimateMaxBlocks() override { - return ::feeEstimator.HighestTargetTracked(FeeEstimateHorizon::LONG_HALFLIFE); + if (!m_node.fee_estimator) return 0; + return m_node.fee_estimator->HighestTargetTracked(FeeEstimateHorizon::LONG_HALFLIFE); } CFeeRate mempoolMinFee() override { -- cgit v1.2.3