From 82249ac0f462e68ce6531817d8cd1a70acfd7f81 Mon Sep 17 00:00:00 2001 From: Tom Kirkpatrick Date: Tue, 13 Feb 2024 15:34:56 +0000 Subject: [PATCH] Ensure fee multiple is applied --- src/server.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/server.tsx b/src/server.tsx index ad35d07..722f9e2 100644 --- a/src/server.tsx +++ b/src/server.tsx @@ -246,8 +246,7 @@ async function fetchBitcoindFees() : Promise { var feeRate = response[i].result?.feerate; if (feeRate) { // convert the returned value to satoshis, as it's currently returned in BTC. - const satPerKB : number = feeRate * 1e8; - data[target] = applyFeeMultiplier(satPerKB); + data[target] = feeRate * 1e8; } else { logger.error({ message: `Failed to fetch fee estimate from bitcoind for confirmation target ${target}: {errors}`, errors: response[i].result?.errors}); @@ -262,12 +261,14 @@ async function fetchBitcoindFees() : Promise { function processEstimates(estimates: FeeByBlockTarget, applyMultiplier = true, convert = false) : FeeByBlockTarget { for (const [blockTarget, fee] of Object.entries(estimates) as [string, number][]) { + let estimate = fee; if (applyMultiplier) { - estimates[blockTarget] = applyFeeMultiplier(fee); + estimate = applyFeeMultiplier(fee); } if (convert) { - estimates[blockTarget] = Math.ceil(fee * 1000); + estimate = Math.ceil(estimate * 1000); } + estimates[blockTarget] = estimate; } return estimates; }