core/state: call finalise before updateRoot

This commit is contained in:
Gary Rong 2023-08-31 10:29:23 +08:00
parent 28ed26e330
commit 8297c0d6e2

View file

@ -352,9 +352,11 @@ func (s *stateObject) updateTrie() error {
} }
// updateRoot flushes all cached storage mutations to trie, recalculating the // updateRoot flushes all cached storage mutations to trie, recalculating the
// new storage trie root. This function assumes all storage mutations have // new storage trie root.
// already been moved to pendingStorage map by finalise.
func (s *stateObject) updateRoot() { func (s *stateObject) updateRoot() {
// Make sure all dirty slots are finalized into the pending storage area
s.finalise(false)
// Short circuit if nothing changed, don't bother with hashing anything // Short circuit if nothing changed, don't bother with hashing anything
if len(s.pendingStorage) == 0 { if len(s.pendingStorage) == 0 {
return return