Skip to content

Commit

Permalink
rpc: SyncWithValidationInterfaceQueue on fee estimation RPC's
Browse files Browse the repository at this point in the history
This ensures that the most recent fee estimation data is used for the
fee estimation with `estimateSmartfee` and `estimaterawfee` RPC's.
  • Loading branch information
ismaelsadeeq committed Nov 22, 2023
1 parent 7145239 commit 91504cb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/rpc/fees.cpp
Expand Up @@ -14,6 +14,7 @@
#include <txmempool.h>
#include <univalue.h>
#include <util/fees.h>
#include <validationinterface.h>

#include <algorithm>
#include <array>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 91504cb

Please sign in to comment.