invoices: use HTLCSet method with state filter
This commit is contained in:
parent
d93c3298b7
commit
70efaa5fe2
@ -1021,15 +1021,8 @@ func (i *InvoiceRegistry) notifyExitHopHtlcLocked(
|
|||||||
// Also cancel any HTLCs in the HTLC set that are also in the
|
// Also cancel any HTLCs in the HTLC set that are also in the
|
||||||
// canceled state with the same failure result.
|
// canceled state with the same failure result.
|
||||||
setID := ctx.setID()
|
setID := ctx.setID()
|
||||||
for key, htlc := range invoice.Htlcs {
|
canceledHtlcSet := invoice.HTLCSet(setID, channeldb.HtlcStateCanceled)
|
||||||
if htlc.State != channeldb.HtlcStateCanceled {
|
for key, htlc := range canceledHtlcSet {
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if !htlc.IsInHTLCSet(setID) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
htlcFailResolution := NewFailResolution(
|
htlcFailResolution := NewFailResolution(
|
||||||
key, int32(htlc.AcceptHeight), res.Outcome,
|
key, int32(htlc.AcceptHeight), res.Outcome,
|
||||||
)
|
)
|
||||||
@ -1047,11 +1040,9 @@ func (i *InvoiceRegistry) notifyExitHopHtlcLocked(
|
|||||||
// Also settle any previously accepted htlcs. If a htlc is
|
// Also settle any previously accepted htlcs. If a htlc is
|
||||||
// marked as settled, we should follow now and settle the htlc
|
// marked as settled, we should follow now and settle the htlc
|
||||||
// with our peer.
|
// with our peer.
|
||||||
for key, htlc := range invoice.Htlcs {
|
setID := ctx.setID()
|
||||||
if htlc.State != channeldb.HtlcStateSettled {
|
settledHtlcSet := invoice.HTLCSet(setID, channeldb.HtlcStateSettled)
|
||||||
continue
|
for key, htlc := range settledHtlcSet {
|
||||||
}
|
|
||||||
|
|
||||||
preimage := res.Preimage
|
preimage := res.Preimage
|
||||||
if htlc.AMP != nil && htlc.AMP.Preimage != nil {
|
if htlc.AMP != nil && htlc.AMP.Preimage != nil {
|
||||||
preimage = *htlc.AMP.Preimage
|
preimage = *htlc.AMP.Preimage
|
||||||
|
Loading…
Reference in New Issue
Block a user