Unverified Commit a2c456a5 authored by Guillaume Ballet's avatar Guillaume Ballet Committed by GitHub

core: ensure a broken trie invariant crashes genesis creation (#22780)

* Ensure state could be created in ToBlock

* Fix rebase errors

* use a panic instead
parent f34f749e
......@@ -259,7 +259,10 @@ func (g *Genesis) ToBlock(db ethdb.Database) *types.Block {
if db == nil {
db = rawdb.NewMemoryDatabase()
}
statedb, _ := state.New(common.Hash{}, state.NewDatabase(db), nil)
statedb, err := state.New(common.Hash{}, state.NewDatabase(db), nil)
if err != nil {
panic(err)
}
for addr, account := range g.Alloc {
statedb.AddBalance(addr, account.Balance)
statedb.SetCode(addr, account.Code)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment