Skip to content

Commit

Permalink
trie: handle more batch commit errors in Database (#25674)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamandlou committed Sep 15, 2022
1 parent a89b7ad commit 57a65f0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions trie/database.go
Expand Up @@ -662,8 +662,9 @@ func (db *Database) Commit(node common.Hash, report bool, callback func(common.H
// Uncache any leftovers in the last batch
db.lock.Lock()
defer db.lock.Unlock()

batch.Replay(uncacher)
if err := batch.Replay(uncacher); err != nil {
return err
}
batch.Reset()

// Reset the storage counters and bumped metrics
Expand Down Expand Up @@ -711,9 +712,12 @@ func (db *Database) commit(hash common.Hash, batch ethdb.Batch, uncacher *cleane
return err
}
db.lock.Lock()
batch.Replay(uncacher)
err := batch.Replay(uncacher)
batch.Reset()
db.lock.Unlock()
if err != nil {
return err
}
}
return nil
}
Expand Down

0 comments on commit 57a65f0

Please sign in to comment.