@@ -128,29 +128,13 @@ func (r *Receipt) EncodeRLP(w io.Writer) error {
128128 buf := encodeBufferPool .Get ().(* bytes.Buffer )
129129 defer encodeBufferPool .Put (buf )
130130 buf .Reset ()
131- if err := r .encodeTyped (data , buf ); err != nil {
131+ buf .WriteByte (r .Type )
132+ if err := rlp .Encode (buf , data ); err != nil {
132133 return err
133134 }
134135 return rlp .Encode (w , buf .Bytes ())
135136}
136137
137- // encodeTyped writes the canonical encoding of a typed receipt to w.
138- func (r * Receipt ) encodeTyped (data * receiptRLP , w * bytes.Buffer ) error {
139- w .WriteByte (r .Type )
140- return rlp .Encode (w , data )
141- }
142-
143- // MarshalBinary returns the consensus encoding of the receipt.
144- func (r * Receipt ) MarshalBinary () ([]byte , error ) {
145- if r .Type == LegacyTxType {
146- return rlp .EncodeToBytes (r )
147- }
148- data := & receiptRLP {r .statusEncoding (), r .CumulativeGasUsed , r .Bloom , r .Logs }
149- var buf bytes.Buffer
150- err := r .encodeTyped (data , & buf )
151- return buf .Bytes (), err
152- }
153-
154138// DecodeRLP implements rlp.Decoder, and loads the consensus fields of a receipt
155139// from an RLP stream.
156140func (r * Receipt ) DecodeRLP (s * rlp.Stream ) error {
@@ -182,23 +166,6 @@ func (r *Receipt) DecodeRLP(s *rlp.Stream) error {
182166 }
183167}
184168
185- // UnmarshalBinary decodes the consensus encoding of receipts.
186- // It supports legacy RLP receipts and EIP-2718 typed receipts.
187- func (r * Receipt ) UnmarshalBinary (b []byte ) error {
188- if len (b ) > 0 && b [0 ] > 0x7f {
189- // It's a legacy receipt decode the RLP
190- var data receiptRLP
191- err := rlp .DecodeBytes (b , & data )
192- if err != nil {
193- return err
194- }
195- r .Type = LegacyTxType
196- return r .setFromRLP (data )
197- }
198- // It's an EIP2718 typed transaction envelope.
199- return r .decodeTyped (b )
200- }
201-
202169// decodeTyped decodes a typed receipt from the canonical format.
203170func (r * Receipt ) decodeTyped (b []byte ) error {
204171 if len (b ) <= 1 {
0 commit comments