Skip to content

Commit

Permalink
core/state: check db error after intermediate call (ethereum#30171)
Browse files Browse the repository at this point in the history
This pull request adds an additional error check after statedb.IntermediateRoot,
ensuring that no errors occur during this call. This step is essential, as the call might
encounter database errors.
  • Loading branch information
rjl493456442 authored and leeren committed Aug 16, 2024
1 parent 966107a commit f052e3f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,10 @@ func (s *StateDB) commit(deleteEmptyObjects bool) (*stateUpdate, error) {
// Finalize any pending changes and merge everything into the tries
s.IntermediateRoot(deleteEmptyObjects)

// Short circuit if any error occurs within the IntermediateRoot.
if s.dbErr != nil {
return nil, fmt.Errorf("commit aborted due to database error: %v", s.dbErr)
}
// Commit objects to the trie, measuring the elapsed time
var (
accountTrieNodesUpdated int
Expand Down

0 comments on commit f052e3f

Please sign in to comment.