Skip to content

Commit

Permalink
Merge pull request #35 from LN-Zap/fixes
Browse files Browse the repository at this point in the history
Ensure fee multiple is applied
  • Loading branch information
mrfelton authored Feb 13, 2024
2 parents 7285a4e + 82249ac commit 8d69e1c
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 8d69e1c

Please sign in to comment.