Skip to content

Commit de6672d

Browse files
committed
core/state: fix broken test
1 parent 72d575a commit de6672d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

core/state/statedb.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,18 +1302,20 @@ func (s *StateDB) commit(deleteEmptyObjects bool, rawStorageKey bool, blockNumbe
13021302
// Clear all internal flags and update state root at the end.
13031303
s.mutations = make(map[common.Address]*mutation)
13041304
s.stateObjectsDestruct = make(map[common.Address]*stateObject)
1305-
s.reader, _ = s.db.Reader(root)
13061305

13071306
origin := s.originalRoot
13081307
s.originalRoot = root
13091308

1310-
update := newStateUpdate(rawStorageKey, origin, root, blockNumber, deletes, updates, nodes)
1311-
13121309
start = time.Now()
1310+
update := newStateUpdate(rawStorageKey, origin, root, blockNumber, deletes, updates, nodes)
13131311
if err := s.db.Commit(update); err != nil {
13141312
return nil, err
13151313
}
13161314
s.DatabaseCommits = time.Since(start)
1315+
1316+
// The reader update must be performed as the final step, otherwise,
1317+
// the new state would not be visible before db.commit.
1318+
s.reader, _ = s.db.Reader(root)
13171319
return update, nil
13181320
}
13191321

0 commit comments

Comments
 (0)