Skip to content

Commit

Permalink
core: initialize current block/fastblock atomics to nil, fix #19286 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman authored Sep 26, 2019
1 parent 2133f18 commit ead7117
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit ead7117

Please sign in to comment.