Skip to content

Commit

Permalink
core: cache block after wroten into db (#2600)
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanBSC authored Jul 22, 2024
1 parent b844958 commit a44b6d8
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 @@ -1801,6 +1801,12 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types.
if err := blockBatch.Write(); err != nil {
log.Crit("Failed to write block into disk", "err", err)
}
bc.hc.tdCache.Add(block.Hash(), externTd)
bc.blockCache.Add(block.Hash(), block)
bc.receiptsCache.Add(block.Hash(), receipts)
if bc.chainConfig.IsCancun(block.Number(), block.Time()) {
bc.sidecarsCache.Add(block.Hash(), block.Sidecars())
}
wg.Done()
}()

Expand Down

0 comments on commit a44b6d8

Please sign in to comment.