diff --git a/eth/protocols/eth/receipt.go b/eth/protocols/eth/receipt.go index 263fc7db67..e51c02fa2a 100644 --- a/eth/protocols/eth/receipt.go +++ b/eth/protocols/eth/receipt.go @@ -140,6 +140,28 @@ type ReceiptList struct { items rlp.RawList[Receipt] } +// NewReceiptList creates a receipt list. +// This is slow, and exists for testing purposes. +func NewReceiptList(trs []*types.Receipt) *ReceiptList { + rl := new(ReceiptList) + for _, tr := range trs { + r := newReceipt(tr) + encoded, _ := rlp.EncodeToBytes(&r) + rl.items.AppendRaw(encoded) + } + return rl +} + +// DecodeRLP decodes a list receipts from the network format. +func (rl *ReceiptList) DecodeRLP(s *rlp.Stream) error { + return rl.items.DecodeRLP(s) +} + +// EncodeRLP encodes the list into the network format of eth/69. +func (rl *ReceiptList) EncodeRLP(w io.Writer) error { + return rl.items.EncodeRLP(w) +} + // EncodeForStorage encodes a list of receipts for the database. // It only strips the first element (TxType) from each receipt's // raw RLP without the actual decoding and re-encoding. @@ -169,28 +191,6 @@ func (rl *ReceiptList) EncodeForStorage() (rlp.RawValue, error) { return out.Bytes(), nil } -// NewReceiptList creates a receipt list. -// This is slow, and exists for testing purposes. -func NewReceiptList(trs []*types.Receipt) *ReceiptList { - rl := new(ReceiptList) - for _, tr := range trs { - r := newReceipt(tr) - encoded, _ := rlp.EncodeToBytes(&r) - rl.items.AppendRaw(encoded) - } - return rl -} - -// DecodeRLP decodes a list receipts from the network format. -func (rl *ReceiptList) DecodeRLP(s *rlp.Stream) error { - return rl.items.DecodeRLP(s) -} - -// EncodeRLP encodes the list into the network format of eth/69. -func (rl *ReceiptList) EncodeRLP(w io.Writer) error { - return rl.items.EncodeRLP(w) -} - // Derivable returns a DerivableList, which can be used to decode func (rl *ReceiptList) Derivable() types.DerivableList { var bloomBuf [6]byte