Skip to content

Commit

Permalink
Merge pull request #20 from LN-Zap/limit-history
Browse files Browse the repository at this point in the history
Only add history estimates beyond mempool depth
  • Loading branch information
mrfelton authored Jan 11, 2024
2 parents 9163f84 + 55d302e commit 114628d
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 114628d

Please sign in to comment.