Skip to content

Commit

Permalink
core: initialize current block/fastblock atomics to nil, fix ethereum…
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman authored and enriquefynn committed Feb 15, 2021
1 parent 4f9cd0f commit a5652ab
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 a5652ab

Please sign in to comment.