core: initialize current block/fastblock atomics to nil, fix #19286 (#19352)

ChrisChinchilla-patch-3
Martin Holst Swende 5 years ago committed by GitHub
parent 2133f18f15
commit ead711779d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      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
}

Loading…
Cancel
Save