Pass loop variable to defer function
The loop variable changes before the defer executes, so we need to pass it to the function to make sure the closure has the correct version of the loop variable.
This commit is contained in:
parent
a88d316b0a
commit
627f95403f
@ -43,7 +43,7 @@ func PluginCommitUpdate(pl *plugins.PluginLoader, num uint64) {
|
|||||||
}
|
}
|
||||||
for i := min ; i < num; i++ {
|
for i := min ; i < num; i++ {
|
||||||
update, ok := freezerUpdates[i]
|
update, ok := freezerUpdates[i]
|
||||||
defer func() { delete(freezerUpdates, i) }()
|
defer func(i uint64) { delete(freezerUpdates, i) }(i)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Warn("Attempting to commit untracked block", "num", i)
|
log.Warn("Attempting to commit untracked block", "num", i)
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user