Skip to content

Commit

Permalink
swap: exclude non-active swap in csvPassedCallback
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
YusukeShimizu committed Sep 18, 2024
1 parent 3cdcdbd commit 2132b1e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions swap/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 2132b1e

Please sign in to comment.