mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-11 01:11:02 +02:00
invoices: cancel htlc on HtlcModify signal
This commit is contained in:
parent
2999b37607
commit
6f401b4265
@ -1049,6 +1049,8 @@ func (i *InvoiceRegistry) notifyExitHopHtlcLocked(
|
|||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var cancelSet bool
|
||||||
|
|
||||||
// Provide the invoice to the settlement interceptor to allow
|
// Provide the invoice to the settlement interceptor to allow
|
||||||
// the interceptor's client an opportunity to manipulate the
|
// the interceptor's client an opportunity to manipulate the
|
||||||
// settlement process.
|
// settlement process.
|
||||||
@ -1066,6 +1068,8 @@ func (i *InvoiceRegistry) notifyExitHopHtlcLocked(
|
|||||||
if resp.AmountPaid != 0 {
|
if resp.AmountPaid != 0 {
|
||||||
ctx.amtPaid = resp.AmountPaid
|
ctx.amtPaid = resp.AmountPaid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cancelSet = resp.CancelSet
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("error during invoice HTLC interception: %w",
|
err := fmt.Errorf("error during invoice HTLC interception: %w",
|
||||||
@ -1092,7 +1096,18 @@ func (i *InvoiceRegistry) notifyExitHopHtlcLocked(
|
|||||||
updateDesc.State != nil
|
updateDesc.State != nil
|
||||||
|
|
||||||
// Assign resolution to outer scope variable.
|
// Assign resolution to outer scope variable.
|
||||||
|
if cancelSet {
|
||||||
|
// If a cancel signal was set for the htlc set, we set
|
||||||
|
// the resolution as a failure with an underpayment
|
||||||
|
// indication. Something was wrong with this htlc, so
|
||||||
|
// we probably can't settle the invoice at all.
|
||||||
|
resolution = NewFailResolution(
|
||||||
|
ctx.circuitKey, ctx.currentHeight,
|
||||||
|
ResultAmountTooLow,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
resolution = res
|
resolution = res
|
||||||
|
}
|
||||||
|
|
||||||
return updateDesc, nil
|
return updateDesc, nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user