From d5e5aa7c5ff3aec7556f52c2f7b939216b53c93c Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Fri, 11 Oct 2024 11:04:35 -0300 Subject: [PATCH] htlcswitch: fix linter warnings --- htlcswitch/switch.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htlcswitch/switch.go b/htlcswitch/switch.go index 6c25088e07..5e4cf59b39 100644 --- a/htlcswitch/switch.go +++ b/htlcswitch/switch.go @@ -1757,6 +1757,7 @@ out: func (s *Switch) Start() error { if !atomic.CompareAndSwapInt32(&s.started, 0, 1) { log.Warn("Htlc Switch already started") + return errors.New("htlc switch already started") } @@ -1777,12 +1778,15 @@ func (s *Switch) Start() error { err = fmt.Errorf("unable to start htlc forwarder: %w", ErrSwitchExiting) log.Errorf("%v", err) + return err } if err := s.reforwardResponses(); err != nil { - s.Stop() + // We are already stopping so we can ignore the error. + _ = s.Stop() log.Errorf("unable to reforward responses: %v", err) + return err } @@ -1790,6 +1794,7 @@ func (s *Switch) Start() error { // We are already stopping so we can ignore the error. _ = s.Stop() log.Errorf("unable to reforward resolutions: %v", err) + return err }