mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-13 10:21:37 +00:00
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:
parent
9d2b04de29
commit
59ca98ddbe
3 changed files with 7 additions and 15 deletions
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue