From 2132b1eb9bc808950d577ed89881f45320758a4e Mon Sep 17 00:00:00 2001 From: bruwbird Date: Wed, 18 Sep 2024 15:20:13 +0900 Subject: [PATCH] swap: exclude non-active swap in csvPassedCallback csv wait list is always added in AwaitPaymentOrCsvAction state but removed only after csvPassedCallback. csvPassedCallback always assumes an active swap, but in normal flows like preimage path, the swap might be complete, leaving no active swap at this point. This was not considered before, causing continuous errors. --- swap/service.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/swap/service.go b/swap/service.go index 5a4e45e3..13852ba2 100644 --- a/swap/service.go +++ b/swap/service.go @@ -348,6 +348,9 @@ func (s *SwapService) OnTxConfirmed(swapId string, txHex string, gotErr error) e // OnCsvPassed sends the csvpassed event to the corresponding swap func (s *SwapService) OnCsvPassed(swapId string) error { swap, err := s.GetActiveSwap(swapId) + if errors.Is(err, ErrSwapDoesNotExist) { + return nil + } if err != nil { return err }