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{})