From 1fbe272ae4b5116c3448e98310eedbd5db8d37c8 Mon Sep 17 00:00:00 2001 From: Gary Rong Date: Tue, 16 Jul 2024 18:50:30 +0800 Subject: [PATCH] core/state: check db error after intermediate call --- core/state/statedb.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/state/statedb.go b/core/state/statedb.go index 1664a446f4..0090abf684 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -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