From ead711779d6e2e1d4593d7dcede8ae6454a3b961 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Thu, 26 Sep 2019 11:10:35 +0200 Subject: [PATCH] core: initialize current block/fastblock atomics to nil, fix #19286 (#19352) --- core/blockchain.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/blockchain.go b/core/blockchain.go index 8b713d9e0..9fb02b148 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -228,10 +228,16 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, chainConfig *par if bc.genesisBlock == nil { return nil, ErrNoGenesis } + + var nilBlock *types.Block + bc.currentBlock.Store(nilBlock) + bc.currentFastBlock.Store(nilBlock) + // Initialize the chain with ancient data if it isn't empty. if bc.empty() { rawdb.InitDatabaseFromFreezer(bc.db) } + if err := bc.loadLastState(); err != nil { return nil, err }