From b1f0a3c79b58d1dcacdac798a29778b245e3290d Mon Sep 17 00:00:00 2001 From: buddho Date: Tue, 13 Aug 2024 14:02:38 +0800 Subject: [PATCH] core: fix cache for receipts (#2643) --- core/blockchain.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index 23d42f2b7..c50520b20 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1803,7 +1803,7 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types. } bc.hc.tdCache.Add(block.Hash(), externTd) bc.blockCache.Add(block.Hash(), block) - bc.receiptsCache.Add(block.Hash(), receipts) + bc.cacheReceipts(block.Hash(), receipts, block) if bc.chainConfig.IsCancun(block.Number(), block.Time()) { bc.sidecarsCache.Add(block.Hash(), block.Sidecars()) } @@ -2320,8 +2320,6 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool) (int, error) return it.index, err } - bc.cacheReceipts(block.Hash(), receipts, block) - // Update the metrics touched during block commit accountCommitTimer.Update(statedb.AccountCommits) // Account commits are complete, we can mark them storageCommitTimer.Update(statedb.StorageCommits) // Storage commits are complete, we can mark them