Skip to content

Commit

Permalink
Apply min fee fallback after filter
Browse files Browse the repository at this point in the history
  • Loading branch information
mrfelton committed Feb 13, 2024
1 parent 73b7165 commit 1fb0a57
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -424,14 +424,14 @@ function calculateFees(mempoolFeeEstimates: MempoolFeeEstimates, esploraFeeEstim
const minFee = (mempoolFeeEstimates?.minimumFee ?? FEE_MINIMUM) * 1000;
logger.debug({ message: 'Using minimum fee: {minFee}', minFee });

// If we didn't manage to get any fee estimates, return a single estimate with the minimum fee.
if (Object.keys(feeByBlockTarget).length === 0) {
return { 1: minFee }
}

// Return fees filterd to remove any that are lower than the determined minimum fee.
if (minFee) {
return filterEstimates(feeByBlockTarget, minFee);
// Filter the estimates to remove any that are lower than the desired minimum fee.
feeByBlockTarget = filterEstimates(feeByBlockTarget, minFee);

// If we didn't manage to get any fee estimates, return a single estimate with the minimum fee.
if (Object.keys(feeByBlockTarget).length === 0) {
feeByBlockTarget = { 1: minFee }
}
}

return feeByBlockTarget;
Expand Down

0 comments on commit 1fb0a57

Please sign in to comment.