From 773907095af3e069da5af9daa5de183586d9584f Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 3 Mar 2026 10:39:33 -0800 Subject: round fees --- index.ts | 3 ++- lib/payments.ts | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/index.ts b/index.ts index 2acf685b..784baa5d 100644 --- a/index.ts +++ b/index.ts @@ -5,6 +5,7 @@ import { admin, auth, optional } from "$lib/auth"; import { g, s } from "$lib/db"; import { fixBolt12, listenForLightning, replay } from "$lib/lightning"; +import { l } from "$lib/logging"; import { startHealthCheck } from "$lib/health"; import { getLocations } from "$lib/locations"; import { @@ -261,7 +262,7 @@ Bun.serve({ hostname: host_, }); -console.log(`coinos server listening on ${host_}:${port}`); +l(`coinos server listening on ${host_}:${port}`); const logerr = (e: Error) => console.log(e); process.on("unhandledRejection", logerr); diff --git a/lib/payments.ts b/lib/payments.ts index 363fb8ff..057a98ca 100644 --- a/lib/payments.ts +++ b/lib/payments.ts @@ -962,7 +962,6 @@ const buildNonCustodial = async ({ aid, amount, address, feeRate, subtract, user fees.fastestFee = Math.ceil(fees.fastestFee * 1.5); if (!feeRate) feeRate = fees.halfHourFee; - if (feeRate < fees.hourFee) fail("fee rate too low"); const nextIndex = account.nextIndex || 0; @@ -1020,7 +1019,7 @@ const buildNonCustodial = async ({ aid, amount, address, feeRate, subtract, user let selected = selectUTXO(utxoInputs, outputs, "default", { changeAddress, - feePerByte: BigInt(feeRate), + feePerByte: BigInt(Math.ceil(feeRate)), network: btcNetwork, createTx: true, }); @@ -1035,7 +1034,7 @@ const buildNonCustodial = async ({ aid, amount, address, feeRate, subtract, user const maxOutputs = [{ address, amount: BigInt(amount) }]; selected = selectUTXO(utxoInputs, maxOutputs, "all", { changeAddress, - feePerByte: BigInt(feeRate), + feePerByte: BigInt(Math.ceil(feeRate)), network: btcNetwork, createTx: true, }); -- cgit v1.2.3