From fbac246f3977bbd853f9867e0d38c8ec8d9b47cd Mon Sep 17 00:00:00 2001 From: jsvisa Date: Wed, 28 May 2025 12:36:01 +0800 Subject: [PATCH] core/state: add CommitWithUpdate method Signed-off-by: jsvisa --- core/state/statedb.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/state/statedb.go b/core/state/statedb.go index b8f3e9d591..0ca74a4c0d 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -1356,6 +1356,16 @@ func (s *StateDB) Commit(block uint64, deleteEmptyObjects bool, noStorageWiping 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. // This method must be invoked before state transition. //