core: fix writeBlock

This commit is contained in:
JukLee0ira 2024-08-07 11:39:57 +08:00 committed by Daniel Liu
parent 52077f18f3
commit 074095b1d5

View file

@ -684,7 +684,9 @@ func (bc *BlockChain) insert(block *types.Block, writeBlock bool) {
// Add the block to the canonical chain number scheme and mark as the head
rawdb.WriteCanonicalHash(bc.db, block.Hash(), block.NumberU64())
rawdb.WriteHeadBlockHash(bc.db, block.Hash())
rawdb.WriteBlock(bc.db, block)
if writeBlock {
rawdb.WriteBlock(bc.db, block)
}
bc.currentBlock.Store(block)
// save cache BlockSigners