Skip to content

Commit a5511b1

Browse files
committed
htlcswitch: fix linter warnings
1 parent 8672a69 commit a5511b1

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

htlcswitch/switch.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,6 +1767,7 @@ out:
17671767
func (s *Switch) Start() error {
17681768
if !atomic.CompareAndSwapInt32(&s.started, 0, 1) {
17691769
log.Warn("Htlc Switch already started")
1770+
17701771
return errors.New("htlc switch already started")
17711772
}
17721773

@@ -1782,22 +1783,27 @@ func (s *Switch) Start() error {
17821783
s.htlcForwarder()
17831784
})
17841785
if err != nil {
1785-
s.Stop()
1786+
// We are already stopping so we can ignore the error.
1787+
_ = s.Stop()
17861788
err = fmt.Errorf("unable to start htlc forwarder: %w", err)
17871789
log.Errorf("%v", err)
1790+
17881791
return err
17891792
}
17901793

17911794
if err := s.reforwardResponses(); err != nil {
1792-
s.Stop()
1795+
// We are already stopping so we can ignore the error.
1796+
_ = s.Stop()
17931797
log.Errorf("unable to reforward responses: %v", err)
1798+
17941799
return err
17951800
}
17961801

17971802
if err := s.reforwardResolutions(); err != nil {
17981803
// We are already stopping so we can ignore the error.
17991804
_ = s.Stop()
18001805
log.Errorf("unable to reforward resolutions: %v", err)
1806+
18011807
return err
18021808
}
18031809

htlcswitch/switch_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1780,7 +1780,9 @@ func TestSwitchForwardCircuitPersistence(t *testing.T) {
17801780

17811781
cdb2, err := channeldb.Open(tempPath)
17821782
require.NoError(t, err, "unable to reopen channeldb")
1783-
t.Cleanup(func() { cdb2.Close() })
1783+
t.Cleanup(func() {
1784+
require.NoError(t, cdb2.Close())
1785+
})
17841786

17851787
s2, err := initSwitchWithDB(testStartingHeight, cdb2)
17861788
require.NoError(t, err, "unable reinit switch")

0 commit comments

Comments
 (0)