From e2f36a475245855826b907319becd0616ef9c329 Mon Sep 17 00:00:00 2001 From: hepengfei Date: Thu, 20 Jun 2019 20:40:29 +0800 Subject: [PATCH] core: block may be nil in block.Hash() --- core/genesis.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/genesis.go b/core/genesis.go index 830fb033b8..cab9c645db 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -183,7 +183,11 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, genesis *Genesis, constant return genesis.Config, hash, &GenesisMismatchError{stored, hash} } 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.