From 05012c62989ebfb1dbebb69a02eee61ecee2251f Mon Sep 17 00:00:00 2001 From: boufni95 Date: Thu, 27 Nov 2025 15:36:59 +0000 Subject: [PATCH] fix for network fee change --- src/services/lnd/lsp.ts | 2 +- src/services/main/liquidityManager.ts | 2 +- src/services/main/liquidityProvider.ts | 2 +- src/services/main/paymentManager.ts | 4 ++-- src/services/metrics/index.ts | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/services/lnd/lsp.ts b/src/services/lnd/lsp.ts index e734c62c..bfce76fb 100644 --- a/src/services/lnd/lsp.ts +++ b/src/services/lnd/lsp.ts @@ -101,7 +101,7 @@ export class FlashsatsLSP extends LSP { return null } const res = await this.liquidityProvider.PayInvoice(order.payment.bolt11_invoice, decoded.numSatoshis, 'system') - const fees = +order.payment.fee_total_sat + res.network_fee + res.service_fee + const fees = +order.payment.fee_total_sat + res.service_fee this.log("paid", res.amount_paid, "to open channel, and a fee of", fees) return { orderId: order.order_id, invoice: order.payment.bolt11_invoice, totalSats: +order.payment.order_total_sat, fees } diff --git a/src/services/main/liquidityManager.ts b/src/services/main/liquidityManager.ts index f90631ab..8e4d635c 100644 --- a/src/services/main/liquidityManager.ts +++ b/src/services/main/liquidityManager.ts @@ -132,7 +132,7 @@ export class LiquidityManager { try { const invoice = await this.lnd.NewInvoice(amt, "liqudity provider drain", defaultInvoiceExpiry, { from: 'system', useProvider: false }) const res = await this.liquidityProvider.PayInvoice(invoice.payRequest, amt, 'system') - const fees = res.network_fee + res.service_fee + const fees = res.service_fee this.feesPaid += fees this.updateLatestDrain(true, amt) } catch (err: any) { diff --git a/src/services/main/liquidityProvider.ts b/src/services/main/liquidityProvider.ts index 3774c143..9012c5f5 100644 --- a/src/services/main/liquidityProvider.ts +++ b/src/services/main/liquidityProvider.ts @@ -239,7 +239,7 @@ export class LiquidityProvider { this.log("error paying invoice", res.reason) throw new Error(res.reason) } - const totalPaid = res.amount_paid + res.network_fee + res.service_fee + const totalPaid = res.amount_paid + res.service_fee this.incrementProviderBalance(-totalPaid).then(() => { delete this.pendingPayments[invoice] }) this.latestReceivedBalance = res.latest_balance this.utils.stateBundler.AddTxPoint('paidAnInvoice', decodedAmount, { used: 'provider', from, timeDiscount: true }) diff --git a/src/services/main/paymentManager.ts b/src/services/main/paymentManager.ts index 5366b364..2ae747ff 100644 --- a/src/services/main/paymentManager.ts +++ b/src/services/main/paymentManager.ts @@ -317,7 +317,7 @@ export default class { preimage: paymentInfo.preimage, amount_paid: paymentInfo.amtPaid, operation_id: opId, - network_fee: paymentInfo.networkFee, + network_fee: 0, service_fee: serviceFee, latest_balance: user.balance_sats, operation @@ -728,7 +728,7 @@ export default class { return { paid_at_unix: invoice.paid_at_unix, amount: invoice.paid_amount, - network_fee: invoice.routing_fees, + network_fee: 0, service_fee: invoice.service_fees, } } diff --git a/src/services/metrics/index.ts b/src/services/metrics/index.ts index 9774d4c1..1e1b30c7 100644 --- a/src/services/metrics/index.ts +++ b/src/services/metrics/index.ts @@ -241,12 +241,12 @@ export default class Handler { ops.outgoingInvoices.forEach(i => { if (req.include_operations) operations.push({ type: Types.UserOperationType.OUTGOING_INVOICE, amount: i.paid_amount, inbound: false, paidAtUnix: i.paid_at_unix, confirmed: true, service_fee: i.service_fees, network_fee: i.routing_fees, identifier: "", operationId: "", tx_hash: "", internal: i.internal }) totalSpent += i.paid_amount - feesInRange += i.service_fees + feesInRange += (i.service_fees - i.routing_fees) }) ops.outgoingTransactions.forEach(tx => { if (req.include_operations) operations.push({ type: Types.UserOperationType.OUTGOING_TX, amount: tx.paid_amount, inbound: false, paidAtUnix: tx.paid_at_unix, confirmed: tx.confs > 1, service_fee: tx.service_fees, network_fee: tx.chain_fees, identifier: "", operationId: "", tx_hash: tx.tx_hash, internal: tx.internal }) totalSpent += tx.paid_amount - feesInRange += tx.service_fees + feesInRange += (tx.service_fees - tx.chain_fees) }) ops.userToUser.forEach(op => {