Skip to content

Commit

Permalink
core: cache block after wroten into db
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanBSC committed Jul 22, 2024
1 parent 26b236f commit 222e108
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 @@ -1798,6 +1798,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 222e108

Please sign in to comment.