Skip to content

Commit d2245a3

Browse files
palangopiersy
andcommitted
Update op-chain-ops/cmd/celo-migrate/main.go
Co-authored-by: piersy <[email protected]>
1 parent bf9af3b commit d2245a3

File tree

1 file changed

+7
-16
lines changed
  • op-chain-ops/cmd/celo-migrate

1 file changed

+7
-16
lines changed

op-chain-ops/cmd/celo-migrate/main.go

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -251,24 +251,15 @@ func ApplyMigrationChangesToDB(genesis *core.Genesis, dbPath string, dbCache int
251251
}
252252
log.Info("Read chain config from database", "config", cfg)
253253

254-
dbFactory := func() (*state.StateDB, error) {
255-
// Set up the backing store.
256-
underlyingDB := state.NewDatabaseWithConfig(ldb, &trie.Config{
257-
Preimages: true,
258-
})
259-
260-
// Open up the state database.
261-
db, err := state.New(header.Root, underlyingDB, nil)
262-
if err != nil {
263-
return nil, fmt.Errorf("cannot open StateDB: %w", err)
264-
}
265-
266-
return db, nil
267-
}
254+
// Set up the backing store.
255+
underlyingDB := state.NewDatabaseWithConfig(ldb, &trie.Config{
256+
Preimages: true,
257+
})
268258

269-
db, err := dbFactory()
259+
// Open up the state database.
260+
db, err := state.New(header.Root, underlyingDB, nil)
270261
if err != nil {
271-
return nil, fmt.Errorf("cannot create StateDB: %w", err)
262+
return nil, fmt.Errorf("cannot open StateDB: %w", err)
272263
}
273264

274265
// So far we applied changes in the memory VM and collected changes in the genesis struct

0 commit comments

Comments
 (0)