core: block may be nil in block.Hash()

This commit is contained in:
hepengfei 2019-06-20 20:40:29 +08:00
parent 25c3282cf1
commit e2f36a4752

View file

@ -183,7 +183,11 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, genesis *Genesis, constant
return genesis.Config, hash, &GenesisMismatchError{stored, hash} return genesis.Config, hash, &GenesisMismatchError{stored, hash}
} }
block, err := genesis.Commit(db) block, err := genesis.Commit(db)
return genesis.Config, block.Hash(), err var hash common.Hash
if block != nil {
hash = block.Hash()
}
return genesis.Config, hash, err
} }
// Check whether the genesis block is already written. // Check whether the genesis block is already written.