eth/protocols/eth: remove ReceiptsRLPPacket70

Convert the handler to the style used by the eth/69 handler, where the
service* function returns a RawList.
This commit is contained in:
Felix Lange 2026-03-19 11:04:43 +01:00
parent 9d2b04de29
commit 59ca98ddbe
3 changed files with 7 additions and 15 deletions

View file

@ -307,14 +307,14 @@ func ServiceGetReceiptsQuery69(chain *core.BlockChain, query GetReceiptsRequest)
// If the receipts exceed 10 MiB, it trims them and sets the // If the receipts exceed 10 MiB, it trims them and sets the
// lastBlockIncomplete flag. Indices smaller than firstBlockReceiptIndex // lastBlockIncomplete flag. Indices smaller than firstBlockReceiptIndex
// are omitted from the first block receipt list. // 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 ( var (
bytes int bytes int
receipts []rlp.RawValue receipts rlp.RawList[*ReceiptList]
lastBlockIncomplete bool lastBlockIncomplete bool
) )
for i, hash := range query { for i, hash := range query {
if bytes >= softResponseLimit || len(receipts) >= maxReceiptsServe { if bytes >= softResponseLimit || receipts.Len() >= maxReceiptsServe {
break break
} }
results := chain.GetReceiptsRLP(hash) results := chain.GetReceiptsRLP(hash)
@ -341,7 +341,7 @@ func serviceGetReceiptsQuery70(chain *core.BlockChain, query GetReceiptsRequest,
results, lastBlockIncomplete = trimReceiptsRLP(results, 0, maxPacketSize-bytes) results, lastBlockIncomplete = trimReceiptsRLP(results, 0, maxPacketSize-bytes)
} }
receipts = append(receipts, results) receipts.AppendRaw(results)
bytes += len(results) bytes += len(results)
} }

View file

@ -243,10 +243,10 @@ func (p *Peer) ReplyReceiptsRLP69(id uint64, receipts rlp.RawList[*ReceiptList])
} }
// ReplyReceiptsRLP70 is the response to GetReceipts. // ReplyReceiptsRLP70 is the response to GetReceipts.
func (p *Peer) ReplyReceiptsRLP70(id uint64, receipts []rlp.RawValue, lastBlockIncomplete bool) error { func (p *Peer) ReplyReceiptsRLP70(id uint64, receipts rlp.RawList[*ReceiptList], lastBlockIncomplete bool) error {
return p2p.Send(p.rw, ReceiptsMsg, &ReceiptsRLPPacket70{ return p2p.Send(p.rw, ReceiptsMsg, &ReceiptsPacket70{
RequestId: id, RequestId: id,
ReceiptsRLPResponse: receipts, List: receipts,
LastBlockIncomplete: lastBlockIncomplete, LastBlockIncomplete: lastBlockIncomplete,
}) })
} }

View file

@ -245,14 +245,6 @@ type ReceiptsPacket70 struct {
// ReceiptsRLPResponse is used for receipts, when we already have it encoded // ReceiptsRLPResponse is used for receipts, when we already have it encoded
type ReceiptsRLPResponse []rlp.RawValue 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. // NewPooledTransactionHashesPacket represents a transaction announcement packet on eth/68 and newer.
type NewPooledTransactionHashesPacket struct { type NewPooledTransactionHashesPacket struct {
Types []byte Types []byte