Skip to content

Commit 6e934f4

Browse files
authored
eth/protocols/snap: fix batch writer when resuming an aborted sync (#27842)
1 parent 8224bb9 commit 6e934f4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

eth/protocols/snap/sync.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,8 @@ func (s *Syncer) loadSyncStatus() {
730730
}
731731
s.tasks = progress.Tasks
732732
for _, task := range s.tasks {
733+
task := task // closure for task.genBatch in the stacktrie writer callback
734+
733735
task.genBatch = ethdb.HookedBatch{
734736
Batch: s.db.NewBatch(),
735737
OnPut: func(key []byte, value []byte) {
@@ -741,6 +743,8 @@ func (s *Syncer) loadSyncStatus() {
741743
})
742744
for accountHash, subtasks := range task.SubTasks {
743745
for _, subtask := range subtasks {
746+
subtask := subtask // closure for subtask.genBatch in the stacktrie writer callback
747+
744748
subtask.genBatch = ethdb.HookedBatch{
745749
Batch: s.db.NewBatch(),
746750
OnPut: func(key []byte, value []byte) {

0 commit comments

Comments
 (0)