From 0c5200bb43f0a7aada9af152aa4f7173a7a74844 Mon Sep 17 00:00:00 2001 From: zsfelfoldi Date: Tue, 30 Sep 2025 18:33:31 +0200 Subject: [PATCH] core: fix cached receipts format --- core/blockchain.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/blockchain.go b/core/blockchain.go index 4ed8dddce7..a1e5c618f3 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1619,6 +1619,17 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types. bc.blockCache.Add(blockHash, block) rawdb.WriteReceipts(blockBatch, blockHash, block.NumberU64(), receipts) if receipts != nil { + // ensure that receipts are cached in the exact same format as when reconstructed from database. + for _, receipt := range receipts { + if receipt.Logs == nil { + receipt.Logs = []*types.Log{} + } + } + var blobGasPrice *big.Int + if block.ExcessBlobGas() != nil { + blobGasPrice = eip4844.CalcBlobFee(bc.chainConfig, block.Header()) + } + types.Receipts(receipts).DeriveFields(bc.chainConfig, blockHash, block.NumberU64(), block.Time(), block.BaseFee(), blobGasPrice, block.Transactions()) bc.receiptsCache.Add(blockHash, receipts) } else { bc.receiptsCache.Add(blockHash, []*types.Receipt{})