Skip to content

Commit 1939813

Browse files
authored
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.
1 parent 6693fe1 commit 1939813

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/state/statedb.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,6 +1158,10 @@ func (s *StateDB) commit(deleteEmptyObjects bool) (*stateUpdate, error) {
11581158
// Finalize any pending changes and merge everything into the tries
11591159
s.IntermediateRoot(deleteEmptyObjects)
11601160

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

0 commit comments

Comments
 (0)