core/state: abort commit if read errors have occurred (#21039)
This finally adds the error check that the documentation of StateDB.dbErr
promises to do. dbErr was added in 9e5f03b6c
(June 2017), and the check was
already missing in that commit. We somehow survived without it for three years.
This commit is contained in:
committed by
GitHub
parent
1152f45849
commit
b0b65d017f
@ -804,6 +804,9 @@ func (s *StateDB) clearJournalAndRefund() {
|
||||
|
||||
// Commit writes the state to the underlying in-memory trie database.
|
||||
func (s *StateDB) Commit(deleteEmptyObjects bool) (common.Hash, error) {
|
||||
if s.dbErr != nil {
|
||||
return common.Hash{}, fmt.Errorf("commit aborted due to earlier error: %v", s.dbErr)
|
||||
}
|
||||
// Finalize any pending changes and merge everything into the tries
|
||||
s.IntermediateRoot(deleteEmptyObjects)
|
||||
|
||||
|
Reference in New Issue
Block a user