Skip to content

Commit b192b19

Browse files
committed
fix race
1 parent ef26f97 commit b192b19

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

core/state/pruner/pruner.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -434,18 +434,18 @@ func dumpRawTrieDescendants(db ethdb.Database, root common.Hash, output *stateBl
434434
if err != nil {
435435
return
436436
}
437-
go func(iteration int64) {
437+
var startIterator trie.NodeIterator
438+
startIterator, err = storageTr.NodeIterator(big.NewInt((i - 1) << 3).Bytes())
439+
if err != nil {
440+
return
441+
}
442+
go func(startIt trie.NodeIterator, iteration int64) {
438443
threadsRunning.Add(1)
439444
defer threadsRunning.Add(-1)
440445
var err error
441446
defer func() {
442447
resultsPerAccount <- err
443448
}()
444-
var startIt trie.NodeIterator
445-
startIt, err = storageTr.NodeIterator(big.NewInt((iteration - 1) << 3).Bytes())
446-
if err != nil {
447-
return
448-
}
449449

450450
// Traverse the storage trie, and stop if we reach the end of the trie or the end of the current part
451451
var startItPath, endItPath []byte
@@ -481,7 +481,7 @@ func dumpRawTrieDescendants(db ethdb.Database, root common.Hash, output *stateBl
481481
return
482482
}
483483
log.Trace("Finished traversing storage trie", "key", key, "startPath", startItPath, "endPath", endItPath)
484-
}(i)
484+
}(startIterator, i)
485485
}
486486
}()
487487
}

0 commit comments

Comments
 (0)