From 8297c0d6e26efe7db9ea95e666be9bb6dca42b67 Mon Sep 17 00:00:00 2001 From: Gary Rong Date: Thu, 31 Aug 2023 10:29:23 +0800 Subject: [PATCH] core/state: call finalise before updateRoot --- core/state/state_object.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/state/state_object.go b/core/state/state_object.go index b68e157dd2..4ef15c958e 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -352,9 +352,11 @@ func (s *stateObject) updateTrie() error { } // updateRoot flushes all cached storage mutations to trie, recalculating the -// new storage trie root. This function assumes all storage mutations have -// already been moved to pendingStorage map by finalise. +// new storage trie root. 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 if len(s.pendingStorage) == 0 { return