From 9cf9fae668d281f90e337ab197983fbc5aae50f7 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Thu, 15 Jun 2023 08:18:54 -0400 Subject: [PATCH] core/types: add support for BlobTxType receipts (#27470) Co-authored-by: Felix Lange --- core/types/receipt.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/core/types/receipt.go b/core/types/receipt.go index 8fc9ec989..6b4b89724 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -194,7 +194,7 @@ func (r *Receipt) decodeTyped(b []byte) error { return errShortTypedReceipt } switch b[0] { - case DynamicFeeTxType, AccessListTxType: + case DynamicFeeTxType, AccessListTxType, BlobTxType: var data receiptRLP err := rlp.DecodeBytes(b[1:], &data) if err != nil { @@ -296,14 +296,13 @@ func (rs Receipts) Len() int { return len(rs) } func (rs Receipts) EncodeIndex(i int, w *bytes.Buffer) { r := rs[i] data := &receiptRLP{r.statusEncoding(), r.CumulativeGasUsed, r.Bloom, r.Logs} + if r.Type == LegacyTxType { + rlp.Encode(w, data) + return + } + w.WriteByte(r.Type) switch r.Type { - case LegacyTxType: - rlp.Encode(w, data) - case AccessListTxType: - w.WriteByte(AccessListTxType) - rlp.Encode(w, data) - case DynamicFeeTxType: - w.WriteByte(DynamicFeeTxType) + case AccessListTxType, DynamicFeeTxType, BlobTxType: rlp.Encode(w, data) default: // For unsupported types, write nothing. Since this is for