diff --git a/eth/protocols/eth/handlers.go b/eth/protocols/eth/handlers.go index aeda0455c0..32c55bdafa 100644 --- a/eth/protocols/eth/handlers.go +++ b/eth/protocols/eth/handlers.go @@ -307,14 +307,14 @@ func ServiceGetReceiptsQuery69(chain *core.BlockChain, query GetReceiptsRequest) // If the receipts exceed 10 MiB, it trims them and sets the // lastBlockIncomplete flag. Indices smaller than firstBlockReceiptIndex // are omitted from the first block receipt list. -func serviceGetReceiptsQuery70(chain *core.BlockChain, query GetReceiptsRequest, firstBlockReceiptIndex uint64) ([]rlp.RawValue, bool) { +func serviceGetReceiptsQuery70(chain *core.BlockChain, query GetReceiptsRequest, firstBlockReceiptIndex uint64) (rlp.RawList[*ReceiptList], bool) { var ( bytes int - receipts []rlp.RawValue + receipts rlp.RawList[*ReceiptList] lastBlockIncomplete bool ) for i, hash := range query { - if bytes >= softResponseLimit || len(receipts) >= maxReceiptsServe { + if bytes >= softResponseLimit || receipts.Len() >= maxReceiptsServe { break } results := chain.GetReceiptsRLP(hash) @@ -341,7 +341,7 @@ func serviceGetReceiptsQuery70(chain *core.BlockChain, query GetReceiptsRequest, results, lastBlockIncomplete = trimReceiptsRLP(results, 0, maxPacketSize-bytes) } - receipts = append(receipts, results) + receipts.AppendRaw(results) bytes += len(results) } diff --git a/eth/protocols/eth/peer.go b/eth/protocols/eth/peer.go index b75a8c5fda..754fd02be3 100644 --- a/eth/protocols/eth/peer.go +++ b/eth/protocols/eth/peer.go @@ -243,10 +243,10 @@ func (p *Peer) ReplyReceiptsRLP69(id uint64, receipts rlp.RawList[*ReceiptList]) } // ReplyReceiptsRLP70 is the response to GetReceipts. -func (p *Peer) ReplyReceiptsRLP70(id uint64, receipts []rlp.RawValue, lastBlockIncomplete bool) error { - return p2p.Send(p.rw, ReceiptsMsg, &ReceiptsRLPPacket70{ +func (p *Peer) ReplyReceiptsRLP70(id uint64, receipts rlp.RawList[*ReceiptList], lastBlockIncomplete bool) error { + return p2p.Send(p.rw, ReceiptsMsg, &ReceiptsPacket70{ RequestId: id, - ReceiptsRLPResponse: receipts, + List: receipts, LastBlockIncomplete: lastBlockIncomplete, }) } diff --git a/eth/protocols/eth/protocol.go b/eth/protocols/eth/protocol.go index 3de32dc8de..0df0776c27 100644 --- a/eth/protocols/eth/protocol.go +++ b/eth/protocols/eth/protocol.go @@ -245,14 +245,6 @@ type ReceiptsPacket70 struct { // ReceiptsRLPResponse is used for receipts, when we already have it encoded type ReceiptsRLPResponse []rlp.RawValue -// ReceiptsRLPPacket70 is ReceiptsRLPResponse with request ID and -// LastBlockIncomplete wrapping. -type ReceiptsRLPPacket70 struct { - RequestId uint64 - LastBlockIncomplete bool - ReceiptsRLPResponse -} - // NewPooledTransactionHashesPacket represents a transaction announcement packet on eth/68 and newer. type NewPooledTransactionHashesPacket struct { Types []byte