Skip to content

Commit ead7117

Browse files
authored
core: initialize current block/fastblock atomics to nil, fix #19286 (#19352)
1 parent 2133f18 commit ead7117

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/blockchain.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,16 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, chainConfig *par
228228
if bc.genesisBlock == nil {
229229
return nil, ErrNoGenesis
230230
}
231+
232+
var nilBlock *types.Block
233+
bc.currentBlock.Store(nilBlock)
234+
bc.currentFastBlock.Store(nilBlock)
235+
231236
// Initialize the chain with ancient data if it isn't empty.
232237
if bc.empty() {
233238
rawdb.InitDatabaseFromFreezer(bc.db)
234239
}
240+
235241
if err := bc.loadLastState(); err != nil {
236242
return nil, err
237243
}

0 commit comments

Comments
 (0)