Skip to content

Commit

Permalink
Only add history estimates beyond mempool depth
Browse files Browse the repository at this point in the history
  • Loading branch information
mrfelton committed Jan 11, 2024
1 parent 9163f84 commit 55d302e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,15 @@ function calculateFees(mempoolFeeEstimates: MempoolFeeEstimates | null | undefin

if (esploraFeeEstimates) {
for (const [blockTarget, fee] of Object.entries(esploraFeeEstimates)) {
if (!feeByBlockTarget.hasOwnProperty(blockTarget)) {
const adjustedFee = Math.round(fee * 1000 * feeMultiplier);
if ((!minMempoolFee || adjustedFee < minMempoolFee) && (!minFee || adjustedFee > minFee)) {
feeByBlockTarget[blockTarget] = adjustedFee;
}
}
const blockTargetInt = parseInt(blockTarget);
const adjustedFee = Math.round(fee * 1000 * feeMultiplier);

if (feeByBlockTarget.hasOwnProperty(blockTarget)) continue;
if (minMempoolFee && adjustedFee >= minMempoolFee) continue;
if (minFee && adjustedFee <= minFee) continue;
if (blockTargetInt <= mempoolDepth) continue;

feeByBlockTarget[blockTarget] = adjustedFee;
}
}

Expand Down

0 comments on commit 55d302e

Please sign in to comment.