mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
core: fix cached receipts format
This commit is contained in:
parent
6411f1e0ff
commit
0c5200bb43
1 changed files with 11 additions and 0 deletions
|
|
@ -1619,6 +1619,17 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types.
|
||||||
bc.blockCache.Add(blockHash, block)
|
bc.blockCache.Add(blockHash, block)
|
||||||
rawdb.WriteReceipts(blockBatch, blockHash, block.NumberU64(), receipts)
|
rawdb.WriteReceipts(blockBatch, blockHash, block.NumberU64(), receipts)
|
||||||
if receipts != nil {
|
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)
|
bc.receiptsCache.Add(blockHash, receipts)
|
||||||
} else {
|
} else {
|
||||||
bc.receiptsCache.Add(blockHash, []*types.Receipt{})
|
bc.receiptsCache.Add(blockHash, []*types.Receipt{})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue