Skip to content

Commit be19c57

Browse files
committed
staticaddr: pass parameters to goroutine over loop
1 parent 8285bc7 commit be19c57

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

staticaddr/loopin/manager.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,16 +473,15 @@ func (m *Manager) recoverLoopIns(ctx context.Context) error {
473473
}
474474

475475
// Send the OnRecover event to the state machine.
476-
swapHash := loopIn.SwapHash
477-
go func() {
478-
err = fsm.SendEvent(ctx, OnRecover, nil)
476+
go func(fsm *FSM, swapHash lntypes.Hash) {
477+
err := fsm.SendEvent(ctx, OnRecover, nil)
479478
if err != nil {
480479
log.Errorf("Error sending OnStart event: %v",
481480
err)
482481
}
483482

484483
m.activeLoopIns[swapHash] = fsm
485-
}()
484+
}(fsm, loopIn.SwapHash)
486485
}
487486

488487
return nil

0 commit comments

Comments
 (0)