core/state: add CommitWithUpdate method

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
jsvisa 2025-05-28 12:36:01 +08:00
parent fc915406d6
commit fbac246f39

View file

@ -1356,6 +1356,16 @@ func (s *StateDB) Commit(block uint64, deleteEmptyObjects bool, noStorageWiping
return ret.Root, nil return ret.Root, nil
} }
// CommitWithUpdate is similar to Commit, commits the state mutations,
// it returns the state update instead of the root hash.
func (s *StateDB) CommitWithUpdate(block uint64, deleteEmptyObjects bool, noStorageWiping bool) (*StateUpdate, error) {
ret, err := s.commitAndFlush(block, deleteEmptyObjects, noStorageWiping)
if err != nil {
return nil, err
}
return ret, nil
}
// Prepare handles the preparatory steps for executing a state transition with. // Prepare handles the preparatory steps for executing a state transition with.
// This method must be invoked before state transition. // This method must be invoked before state transition.
// //