Skip to content

Commit

Permalink
Ensure fee multiple is applied
Browse files Browse the repository at this point in the history
  • Loading branch information
mrfelton committed Feb 13, 2024
1 parent 015e26d commit 82249ac
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,7 @@ async function fetchBitcoindFees() : Promise<FeeByBlockTarget | null> {
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});
Expand All @@ -262,12 +261,14 @@ async function fetchBitcoindFees() : Promise<FeeByBlockTarget | null> {

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;
}
Expand Down

0 comments on commit 82249ac

Please sign in to comment.