Merge pull request #1714 from stackernews/1704-fix-exposed-routing-fees
Don't expose p2p zap receivers to routing fees
This commit is contained in:
commit
6918bcb452
|
@ -501,13 +501,23 @@ function Invoicification ({ n: { invoice, sortTime } }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function WithdrawlPaid ({ n }) {
|
function WithdrawlPaid ({ n }) {
|
||||||
let actionString = n.withdrawl.autoWithdraw ? 'sent to your attached wallet' : 'withdrawn from your account'
|
let amount = n.earnedSats + n.withdrawl.satsFeePaid
|
||||||
|
let actionString = 'withdrawn from your account'
|
||||||
|
|
||||||
|
if (n.withdrawl.autoWithdraw) {
|
||||||
|
actionString = 'sent to your attached wallet'
|
||||||
|
}
|
||||||
|
|
||||||
if (n.withdrawl.forwardedActionType === 'ZAP') {
|
if (n.withdrawl.forwardedActionType === 'ZAP') {
|
||||||
|
// don't expose receivers to routing fees they aren't paying
|
||||||
|
amount = n.earnedSats
|
||||||
actionString = 'zapped directly to your attached wallet'
|
actionString = 'zapped directly to your attached wallet'
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='fw-bold text-info'>
|
<div className='fw-bold text-info'>
|
||||||
<Check className='fill-info me-1' />{numWithUnits(n.earnedSats + n.withdrawl.satsFeePaid, { abbreviate: false, unitSingular: 'sat was ', unitPlural: 'sats were ' })}
|
<Check className='fill-info me-1' />
|
||||||
|
{numWithUnits(amount, { abbreviate: false, unitSingular: 'sat was ', unitPlural: 'sats were ' })}
|
||||||
{actionString}
|
{actionString}
|
||||||
<small className='text-muted ms-1 fw-normal' suppressHydrationWarning>{timeSince(new Date(n.sortTime))}</small>
|
<small className='text-muted ms-1 fw-normal' suppressHydrationWarning>{timeSince(new Date(n.sortTime))}</small>
|
||||||
{(n.withdrawl.forwardedActionType === 'ZAP' && <Badge className={styles.badge} bg={null}>p2p</Badge>) ||
|
{(n.withdrawl.forwardedActionType === 'ZAP' && <Badge className={styles.badge} bg={null}>p2p</Badge>) ||
|
||||||
|
|
|
@ -317,13 +317,11 @@ export async function paidActionForwarded ({ data: { invoiceId, withdrawal, ...a
|
||||||
}, { models, lnd, boss })
|
}, { models, lnd, boss })
|
||||||
|
|
||||||
if (transitionedInvoice) {
|
if (transitionedInvoice) {
|
||||||
const { bolt11, msatsPaid, msatsFeePaid } = transitionedInvoice.invoiceForward.withdrawl
|
const { bolt11, msatsPaid } = transitionedInvoice.invoiceForward.withdrawl
|
||||||
// the amount we paid includes the fee so we need to subtract it to get the amount received
|
|
||||||
const received = Number(msatsPaid) - Number(msatsFeePaid)
|
|
||||||
|
|
||||||
const logger = walletLogger({ wallet: transitionedInvoice.invoiceForward.wallet, models })
|
const logger = walletLogger({ wallet: transitionedInvoice.invoiceForward.wallet, models })
|
||||||
logger.ok(
|
logger.ok(
|
||||||
`↙ payment received: ${formatSats(msatsToSats(received))}`,
|
`↙ payment received: ${formatSats(msatsToSats(Number(msatsPaid)))}`,
|
||||||
{
|
{
|
||||||
bolt11,
|
bolt11,
|
||||||
preimage: transitionedInvoice.preimage
|
preimage: transitionedInvoice.preimage
|
||||||
|
|
Loading…
Reference in New Issue