core/state: check db error after intermediate call

This commit is contained in:
Gary Rong 2024-07-16 18:50:30 +08:00
parent 79d2327771
commit 1fbe272ae4

View file

@ -1172,6 +1172,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