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 3cade73 commit 0b0a1ad
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 0b0a1ad

Please sign in to comment.