Fix fee added to received amount (#1582)
This commit is contained in:
parent
08c29b9f10
commit
b7fc0e0e74
@ -285,9 +285,12 @@ export async function paidActionForwarded ({ data: { invoiceId, withdrawal, ...a
|
|||||||
// settle the invoice, allowing us to transition to PAID
|
// settle the invoice, allowing us to transition to PAID
|
||||||
await settleHodlInvoice({ secret: payment.secret, lnd })
|
await settleHodlInvoice({ secret: payment.secret, lnd })
|
||||||
|
|
||||||
|
// the amount we paid includes the fee so we need to subtract it to get the amount received
|
||||||
|
const received = Number(payment.mtokens) - Number(payment.fee_mtokens)
|
||||||
|
|
||||||
const logger = walletLogger({ wallet: dbInvoice.invoiceForward.wallet, models })
|
const logger = walletLogger({ wallet: dbInvoice.invoiceForward.wallet, models })
|
||||||
logger.ok(
|
logger.ok(
|
||||||
`↙ payment received: ${formatSats(msatsToSats(payment.mtokens))}`,
|
`↙ payment received: ${formatSats(msatsToSats(received))}`,
|
||||||
{
|
{
|
||||||
bolt11,
|
bolt11,
|
||||||
preimage: payment.secret
|
preimage: payment.secret
|
||||||
|
@ -309,8 +309,9 @@ export async function checkWithdrawal ({ data: { hash, withdrawal, invoice }, bo
|
|||||||
notifyWithdrawal(dbWdrwl.userId, wdrwl)
|
notifyWithdrawal(dbWdrwl.userId, wdrwl)
|
||||||
|
|
||||||
const { request: bolt11, secret: preimage } = wdrwl.payment
|
const { request: bolt11, secret: preimage } = wdrwl.payment
|
||||||
|
|
||||||
logger?.ok(
|
logger?.ok(
|
||||||
`↙ payment received: ${formatSats(msatsToSats(Number(wdrwl.payment.mtokens)))}`,
|
`↙ payment received: ${formatSats(msatsToSats(paid))}`,
|
||||||
{
|
{
|
||||||
bolt11,
|
bolt11,
|
||||||
preimage,
|
preimage,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user