mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
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.
This commit is contained in:
parent
a6d061c568
commit
8456314155
1 changed files with 12 additions and 2 deletions
|
|
@ -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():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue