Skip to content

Commit

Permalink
eth/protocols/snap: fix batch writer when resuming an aborted sync (#…
Browse files Browse the repository at this point in the history
…27842) (#587)

Co-authored-by: Péter Szilágyi <[email protected]>
  • Loading branch information
2 people authored and Francesco4203 committed Oct 17, 2024
1 parent 0698ab0 commit 6c75343
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions eth/protocols/snap/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,8 @@ func (s *Syncer) loadSyncStatus() {
}
s.tasks = progress.Tasks
for _, task := range s.tasks {
task := task // closure for task.genBatch in the stacktrie writer callback

task.genBatch = ethdb.HookedBatch{
Batch: s.db.NewBatch(),
OnPut: func(key []byte, value []byte) {
Expand All @@ -726,6 +728,8 @@ func (s *Syncer) loadSyncStatus() {

for accountHash, subtasks := range task.SubTasks {
for _, subtask := range subtasks {
subtask := subtask // closure for subtask.genBatch in the stacktrie writer callback

subtask.genBatch = ethdb.HookedBatch{
Batch: s.db.NewBatch(),
OnPut: func(key []byte, value []byte) {
Expand Down

0 comments on commit 6c75343

Please sign in to comment.