staticaddr: clear stale HTLC confs on re-register

- reset htlcConfirmed when the HTLC conf subscription errors and we re-register
- add regression test ensuring re-registers after a conf error require a fresh
  confirmation instead of sweeping on a stale one
This commit is contained in:
Boris Nagaev 2025-12-16 18:16:41 -03:00 committed by Slyghtning
parent f6ac0b5ebe
commit 258d33cce5
No known key found for this signature in database
GPG key ID: F82D456EA023C9BF

View file

@ -575,6 +575,10 @@ func (f *FSM) MonitorInvoiceAndHtlcTxAction(ctx context.Context,
f.Errorf("htlc tx conf chan error, re-registering: "+
"%v", err)
// A previous confirmation may no longer be valid if the
// subscription failed, so reset and wait for a fresh one.
htlcConfirmed = false
// Re-register for htlc confirmation.
htlcConfChan, htlcErrConfChan, err = registerHtlcConf()
if err != nil {