From 8456314155ec09d85429971f1cda4311b88fcfcc Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Tue, 7 Jul 2026 09:35:14 +0200 Subject: [PATCH] staticaddr/loopin: handle closed invoice updates Treat closed invoice update channels as terminal for the monitor loop. This avoids spinning when lnd closes the subscription after invoice cancellation or shutdown. --- staticaddr/loopin/actions.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/staticaddr/loopin/actions.go b/staticaddr/loopin/actions.go index b411e824..42ac7f1e 100644 --- a/staticaddr/loopin/actions.go +++ b/staticaddr/loopin/actions.go @@ -765,12 +765,22 @@ func (f *FSM) MonitorInvoiceAndHtlcTxAction(ctx context.Context, return f.HandleError(err) - case update := <-invoiceUpdateChan: + case update, ok := <-invoiceUpdateChan: + if !ok { + invoiceUpdateChan = nil + continue + } + if event, done := f.handleInvoiceUpdate(update); done { return event } - case err = <-invoiceErrChan: + case err, ok := <-invoiceErrChan: + if !ok { + invoiceErrChan = nil + continue + } + f.Errorf("invoice subscription error: %v", err) case <-ctx.Done():