Skip to content

Commit a2c456a

Browse files
authored
core: ensure a broken trie invariant crashes genesis creation (ethereum#22780)
* Ensure state could be created in ToBlock * Fix rebase errors * use a panic instead
1 parent f34f749 commit a2c456a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

core/genesis.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,10 @@ func (g *Genesis) ToBlock(db ethdb.Database) *types.Block {
259259
if db == nil {
260260
db = rawdb.NewMemoryDatabase()
261261
}
262-
statedb, _ := state.New(common.Hash{}, state.NewDatabase(db), nil)
262+
statedb, err := state.New(common.Hash{}, state.NewDatabase(db), nil)
263+
if err != nil {
264+
panic(err)
265+
}
263266
for addr, account := range g.Alloc {
264267
statedb.AddBalance(addr, account.Balance)
265268
statedb.SetCode(addr, account.Code)

0 commit comments

Comments
 (0)