From 6273c13efc7ceb62fbed977503bf5b7fe1c2b051 Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Thu, 11 Jul 2024 23:07:45 -0300 Subject: [PATCH] Removes unncessary path logic when initializing arbos in database --- arbos/arbosState/initialize.go | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/arbos/arbosState/initialize.go b/arbos/arbosState/initialize.go index 8b46c19fde..1893308055 100644 --- a/arbos/arbosState/initialize.go +++ b/arbos/arbosState/initialize.go @@ -91,14 +91,9 @@ func InitializeArbosInDatabase(db ethdb.Database, cacheConfig *core.CacheConfig, if err != nil { return common.Hash{}, err } - // When using PathScheme TrieDB.Commit should only be called once. - // When using HashScheme it is called multiple times to avoid keeping - // the entire trie in memory. - if cacheConfig.StateScheme == rawdb.HashScheme { - err = stateDatabase.TrieDB().Commit(root, true) - if err != nil { - return common.Hash{}, err - } + err = stateDatabase.TrieDB().Commit(root, true) + if err != nil { + return common.Hash{}, err } statedb, err = state.New(root, stateDatabase, nil) if err != nil { @@ -196,18 +191,7 @@ func InitializeArbosInDatabase(db ethdb.Database, cacheConfig *core.CacheConfig, if err := accountDataReader.Close(); err != nil { return common.Hash{}, err } - - root, err = commit() - if err != nil { - return common.Hash{}, err - } - if cacheConfig.StateScheme == rawdb.PathScheme { - err = stateDatabase.TrieDB().Commit(root, true) - if err != nil { - return common.Hash{}, err - } - } - return root, nil + return commit() } func initializeRetryables(statedb *state.StateDB, rs *retryables.RetryableState, initData statetransfer.RetryableDataReader, currentTimestamp uint64) error {