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

* Ensure state could be created in ToBlock

* Fix rebase errors

* use a panic instead
revert-23120-drop-eth-65
Guillaume Ballet 4 years ago committed by GitHub
parent f34f749e81
commit a2c456a526
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      core/genesis.go

@ -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)

Loading…
Cancel
Save