rpc: SyncWithValidationInterfaceQueue on fee estimation RPC's

This ensures that the most recent fee estimation data is used for the
fee estimation with `estimateSmartfee` and `estimaterawfee` RPC's.
This commit is contained in:
ismaelsadeeq 2023-11-08 11:21:49 +01:00
parent 714523918b
commit 91504cbe0d

View file

@ -14,6 +14,7 @@
#include <txmempool.h>
#include <univalue.h>
#include <util/fees.h>
#include <validationinterface.h>
#include <algorithm>
#include <array>
@ -67,6 +68,7 @@ static RPCHelpMan estimatesmartfee()
const NodeContext& node = EnsureAnyNodeContext(request.context);
const CTxMemPool& mempool = EnsureMemPool(node);
SyncWithValidationInterfaceQueue();
unsigned int max_target = fee_estimator.HighestTargetTracked(FeeEstimateHorizon::LONG_HALFLIFE);
unsigned int conf_target = ParseConfirmTarget(request.params[0], max_target);
bool conservative = true;
@ -155,6 +157,7 @@ static RPCHelpMan estimaterawfee()
{
CBlockPolicyEstimator& fee_estimator = EnsureAnyFeeEstimator(request.context);
SyncWithValidationInterfaceQueue();
unsigned int max_target = fee_estimator.HighestTargetTracked(FeeEstimateHorizon::LONG_HALFLIFE);
unsigned int conf_target = ParseConfirmTarget(request.params[0], max_target);
double threshold = 0.95;