mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-19 03:57:40 +02:00
multi: don't access loop variables in goroutines
This commit makes sure that no loop variables or other temporary variables are accessed directly in a goroutine but are instead passed into the goroutine through a parameter. This makes sure a copy of the value is put on the stack and is not changed while the outside loop continues.
This commit is contained in:
@@ -432,7 +432,9 @@ func (n *NeutrinoNotifier) notificationDispatcher() {
|
||||
// chain asynchronously to prevent blocking
|
||||
// potentially long rescans.
|
||||
n.wg.Add(1)
|
||||
go func() {
|
||||
|
||||
//nolint:lll
|
||||
go func(msg *chainntnfs.HistoricalConfDispatch) {
|
||||
defer n.wg.Done()
|
||||
|
||||
confDetails, err := n.historicalConfDetails(
|
||||
@@ -457,7 +459,7 @@ func (n *NeutrinoNotifier) notificationDispatcher() {
|
||||
if err != nil {
|
||||
chainntnfs.Log.Error(err)
|
||||
}
|
||||
}()
|
||||
}(msg)
|
||||
|
||||
case *blockEpochRegistration:
|
||||
chainntnfs.Log.Infof("New block epoch subscription")
|
||||
|
Reference in New Issue
Block a user