mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
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 <darosior@protonmail.com>
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include <node/coinstats.h>
|
||||
#include <node/context.h>
|
||||
#include <node/utxo_snapshot.h>
|
||||
#include <policy/fees.h>
|
||||
#include <policy/feerate.h>
|
||||
#include <policy/policy.h>
|
||||
#include <policy/rbf.h>
|
||||
@@ -81,6 +82,15 @@ ChainstateManager& EnsureChainman(const util::Ref& context)
|
||||
return *node.chainman;
|
||||
}
|
||||
|
||||
CBlockPolicyEstimator& EnsureFeeEstimator(const util::Ref& context)
|
||||
{
|
||||
NodeContext& node = EnsureNodeContext(context);
|
||||
if (!node.fee_estimator) {
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Fee estimation disabled");
|
||||
}
|
||||
return *node.fee_estimator;
|
||||
}
|
||||
|
||||
/* Calculate the difficulty for a given block index.
|
||||
*/
|
||||
double GetDifficulty(const CBlockIndex* blockindex)
|
||||
|
||||
Reference in New Issue
Block a user