more fixes

This commit is contained in:
boufni95 2025-11-27 17:01:05 +00:00
parent 62ac0dbbc0
commit a5553c517b
4 changed files with 4 additions and 9 deletions

View file

@ -177,7 +177,7 @@ export class OlympusLSP extends LSP {
return null return null
} }
const res = await this.liquidityProvider.PayInvoice(order.payment.bolt11.invoice, decoded.numSatoshis, 'system') const res = await this.liquidityProvider.PayInvoice(order.payment.bolt11.invoice, decoded.numSatoshis, 'system')
const fees = +order.payment.bolt11.fee_total_sat + res.network_fee + res.service_fee const fees = +order.payment.bolt11.fee_total_sat + res.service_fee
this.log("paid", res.amount_paid, "to open channel, and a fee of", fees) 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.bolt11.order_total_sat, fees } return { orderId: order.order_id, invoice: order.payment.bolt11.invoice, totalSats: +order.payment.bolt11.order_total_sat, fees }
} }
@ -279,7 +279,7 @@ export class VoltageLSP extends LSP {
return null return null
} }
const res = await this.liquidityProvider.PayInvoice(proposalRes.jit_bolt11, decoded.numSatoshis, 'system') const res = await this.liquidityProvider.PayInvoice(proposalRes.jit_bolt11, decoded.numSatoshis, 'system')
const fees = feeSats + res.network_fee + res.service_fee const fees = feeSats + res.service_fee
this.log("paid", res.amount_paid, "to open channel, and a fee of", fees) this.log("paid", res.amount_paid, "to open channel, and a fee of", fees)
return { orderId: fee.id, invoice: proposalRes.jit_bolt11, totalSats: decoded.numSatoshis, fees } return { orderId: fee.id, invoice: proposalRes.jit_bolt11, totalSats: decoded.numSatoshis, fees }
} }

View file

@ -289,7 +289,7 @@ export class DebitManager {
sendDebitPayment = async (appId: string, appUserId: string, requestorPub: string, bolt11: string) => { sendDebitPayment = async (appId: string, appUserId: string, requestorPub: string, bolt11: string) => {
const payment = await this.applicationManager.PayAppUserInvoice(appId, { amount: 0, invoice: bolt11, user_identifier: appUserId, debit_npub: requestorPub }) const payment = await this.applicationManager.PayAppUserInvoice(appId, { amount: 0, invoice: bolt11, user_identifier: appUserId, debit_npub: requestorPub })
await this.storage.debitStorage.IncrementDebitAccess(appUserId, requestorPub, payment.amount_paid + payment.service_fee + payment.network_fee) await this.storage.debitStorage.IncrementDebitAccess(appUserId, requestorPub, payment.amount_paid + payment.service_fee)
return { payment } return { payment }
} }

View file

@ -152,7 +152,7 @@ export class LiquidityProvider {
return 0 return 0
} }
const balance = this.latestReceivedBalance const balance = this.latestReceivedBalance
const { /* networkFeeBps, */ networkFeeFixed, serviceFeeBps } = this.feesCache const { networkFeeFixed, serviceFeeBps } = this.feesCache
const div = 1 + (serviceFeeBps / 10000) const div = 1 + (serviceFeeBps / 10000)
const maxWithoutFixed = Math.floor(balance / div) const maxWithoutFixed = Math.floor(balance / div)
const fee = balance - maxWithoutFixed const fee = balance - maxWithoutFixed

View file

@ -78,9 +78,7 @@ export type LndNodeSettings = {
} }
export type LndSettings = { export type LndSettings = {
lndLogDir: string lndLogDir: string
feeRateLimit: number
feeFixedLimit: number feeFixedLimit: number
feeRateBps: number
mockLnd: boolean mockLnd: boolean
} }
@ -104,11 +102,8 @@ export const LoadLndNodeSettingsFromEnv = (dbEnv: Record<string, string | undefi
} }
export const LoadLndSettingsFromEnv = (dbEnv: Record<string, string | undefined>, addToDb?: EnvCacher): LndSettings => { export const LoadLndSettingsFromEnv = (dbEnv: Record<string, string | undefined>, addToDb?: EnvCacher): LndSettings => {
const feeRateBps: number = chooseEnvInt('OUTBOUND_MAX_FEE_BPS', dbEnv, 60, addToDb)
return { return {
lndLogDir: chooseEnv('LND_LOG_DIR', dbEnv, resolveHome("/.lnd/logs/bitcoin/mainnet/lnd.log"), addToDb), lndLogDir: chooseEnv('LND_LOG_DIR', dbEnv, resolveHome("/.lnd/logs/bitcoin/mainnet/lnd.log"), addToDb),
feeRateBps: feeRateBps,
feeRateLimit: feeRateBps / 10000,
feeFixedLimit: chooseEnvInt('OUTBOUND_MAX_FEE_EXTRA_SATS', dbEnv, 10, addToDb), feeFixedLimit: chooseEnvInt('OUTBOUND_MAX_FEE_EXTRA_SATS', dbEnv, 10, addToDb),
mockLnd: false mockLnd: false
} }