core/state: check db error after intermediate call (#30171)

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.
pull/30216/head
rjl493456442 4 months ago committed by GitHub
parent 6693fe1be2
commit 1939813ece
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      core/state/statedb.go

@ -1158,6 +1158,10 @@ func (s *StateDB) commit(deleteEmptyObjects bool) (*stateUpdate, error) {
// Finalize any pending changes and merge everything into the tries // Finalize any pending changes and merge everything into the tries
s.IntermediateRoot(deleteEmptyObjects) 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 // Commit objects to the trie, measuring the elapsed time
var ( var (
accountTrieNodesUpdated int accountTrieNodesUpdated int

Loading…
Cancel
Save