Skip to content

Commit

Permalink
Update op-chain-ops/cmd/celo-migrate/main.go
Browse files Browse the repository at this point in the history
Co-authored-by: piersy <pierspowlesland@gmail.com>
  • Loading branch information
palango and piersy committed May 7, 2024
1 parent bf9af3b commit d2245a3
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions op-chain-ops/cmd/celo-migrate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,24 +251,15 @@ func ApplyMigrationChangesToDB(genesis *core.Genesis, dbPath string, dbCache int
}
log.Info("Read chain config from database", "config", cfg)

dbFactory := func() (*state.StateDB, error) {
// Set up the backing store.
underlyingDB := state.NewDatabaseWithConfig(ldb, &trie.Config{
Preimages: true,
})

// Open up the state database.
db, err := state.New(header.Root, underlyingDB, nil)
if err != nil {
return nil, fmt.Errorf("cannot open StateDB: %w", err)
}

return db, nil
}
// Set up the backing store.
underlyingDB := state.NewDatabaseWithConfig(ldb, &trie.Config{
Preimages: true,
})

db, err := dbFactory()
// Open up the state database.
db, err := state.New(header.Root, underlyingDB, nil)
if err != nil {
return nil, fmt.Errorf("cannot create StateDB: %w", err)
return nil, fmt.Errorf("cannot open StateDB: %w", err)
}

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

0 comments on commit d2245a3

Please sign in to comment.