diff --git a/core/types/receipt.go b/core/types/receipt.go index 8da2d7cd13..c664cfffd7 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -379,8 +379,31 @@ func (rs Receipts) DeriveFields(config *params.ChainConfig, hash common.Hash, nu // CopyReceipts makes a deep copy of the given receipts. func CopyReceipts(receipts []*Receipt) []*Receipt { result := make([]*Receipt, len(receipts)) - for i, l := range receipts { - cpy := *l + for i, src := range receipts { + // deep copy the receipt + cpy := Receipt{ + Type: src.Type, + PostState: make([]byte, len(src.PostState)), + Status: src.Status, + CumulativeGasUsed: src.CumulativeGasUsed, + Bloom: src.Bloom, + Logs: make([]*Log, len(src.Logs)), + TxHash: src.TxHash, + ContractAddress: src.ContractAddress, + GasUsed: src.GasUsed, + EffectiveGasPrice: new(big.Int).Set(src.EffectiveGasPrice), + BlobGasUsed: src.BlobGasUsed, + BlobGasPrice: new(big.Int).Set(src.BlobGasPrice), + BlockHash: src.BlockHash, + BlockNumber: new(big.Int).Set(src.BlockNumber), + TransactionIndex: src.TransactionIndex, + } + copy(cpy.PostState, src.PostState) + copy(cpy.Bloom[:], src.Bloom.Bytes()) + for j, log := range src.Logs { + theL := *log + cpy.Logs[j] = &theL + } result[i] = &cpy } return result