fix for network fee change
This commit is contained in:
parent
9e3086df0d
commit
05012c6298
5 changed files with 7 additions and 7 deletions
|
|
@ -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 }
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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 })
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue