htlcswitch+itest: catch link quit signal when processing hodlQueue

This commit makes sure when processing resolutions, e.g, settling
invoices, when the link is already broken, the process would exit with
an error. This fixes the issue we found in the itest, where an
unexpected empty remote pending commitment was created although the
remote peer is already offline.
This commit is contained in:
yyforyongyu committed 2025-03-21 03:25:24 +08:00
1 parent 0892b595dd
commit 5a72d5258f
3 files changed
+25

No files matched your search

+5
View File
@@ -1582,6 +1582,11 @@ loop:
select {
case item := <-l.hodlQueue.ChanOut():
htlcResolution = item.(invoices.HtlcResolution)
// No need to process it if the link is broken.
case <-l.cg.Done():
return ErrLinkShuttingDown
default:
break loop
}