diff --git a/core/state/state_object.go b/core/state/state_object.go index ec0c511737..a4a9f5121b 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -482,8 +482,9 @@ func (s *stateObject) commit() (*accountUpdate, *trienode.NodeSet, error) { s.origin = s.data.Copy() return op, nil, nil } - root, nodes := s.trie.Commit(false) - s.data.Root = root + // The storage trie root is omitted, as it has already been updated in the + // previous updateRoot step. + _, nodes := s.trie.Commit(false) s.origin = s.data.Copy() return op, nodes, nil } diff --git a/core/state/statedb.go b/core/state/statedb.go index a4207a10c2..fc2da59a05 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -1162,7 +1162,7 @@ func (s *StateDB) commit(deleteEmptyObjects bool, noStorageWiping bool, blockNum return nil, fmt.Errorf("commit aborted due to earlier error: %v", s.dbErr) } // Finalize any pending changes and merge everything into the tries - s.IntermediateRoot(deleteEmptyObjects) + root := s.IntermediateRoot(deleteEmptyObjects) // Short circuit if any error occurs within the IntermediateRoot. if s.dbErr != nil { @@ -1224,7 +1224,6 @@ func (s *StateDB) commit(deleteEmptyObjects bool, noStorageWiping bool, blockNum // writes to run in parallel with the computations. var ( start = time.Now() - root common.Hash workers errgroup.Group ) // Schedule the account trie first since that will be the biggest, so give @@ -1238,9 +1237,7 @@ func (s *StateDB) commit(deleteEmptyObjects bool, noStorageWiping bool, blockNum // code didn't anticipate for. workers.Go(func() error { // Write the account trie changes, measuring the amount of wasted time - newroot, set := s.trie.Commit(true) - root = newroot - + _, set := s.trie.Commit(true) if err := merge(set); err != nil { return err }