eth/downloader: add missing Requests

pull/30423/head
islishude 1 week ago
parent ec69830b6f
commit caa25017c3
  1. 12
      eth/downloader/queue.go

@ -70,6 +70,7 @@ type fetchResult struct {
Transactions types.Transactions Transactions types.Transactions
Receipts types.Receipts Receipts types.Receipts
Withdrawals types.Withdrawals Withdrawals types.Withdrawals
Requests types.Requests
} }
func newFetchResult(header *types.Header, fastSync bool) *fetchResult { func newFetchResult(header *types.Header, fastSync bool) *fetchResult {
@ -78,8 +79,13 @@ func newFetchResult(header *types.Header, fastSync bool) *fetchResult {
} }
if !header.EmptyBody() { if !header.EmptyBody() {
item.pending.Store(item.pending.Load() | (1 << bodyType)) item.pending.Store(item.pending.Load() | (1 << bodyType))
} else if header.WithdrawalsHash != nil { } else {
item.Withdrawals = make(types.Withdrawals, 0) if header.WithdrawalsHash != nil {
item.Withdrawals = make(types.Withdrawals, 0)
}
if header.RequestsHash != nil {
item.Requests = make(types.Requests, 0)
}
} }
if fastSync && !header.EmptyReceipts() { if fastSync && !header.EmptyReceipts() {
item.pending.Store(item.pending.Load() | (1 << receiptType)) item.pending.Store(item.pending.Load() | (1 << receiptType))
@ -93,6 +99,7 @@ func (f *fetchResult) body() types.Body {
Transactions: f.Transactions, Transactions: f.Transactions,
Uncles: f.Uncles, Uncles: f.Uncles,
Withdrawals: f.Withdrawals, Withdrawals: f.Withdrawals,
Requests: f.Requests,
} }
} }
@ -860,6 +867,7 @@ func (q *queue) DeliverBodies(id string, txLists [][]*types.Transaction, txListH
result.Transactions = txLists[index] result.Transactions = txLists[index]
result.Uncles = uncleLists[index] result.Uncles = uncleLists[index]
result.Withdrawals = withdrawalLists[index] result.Withdrawals = withdrawalLists[index]
result.Requests = requestsLists[index]
result.SetBodyDone() result.SetBodyDone()
} }
return q.deliver(id, q.blockTaskPool, q.blockTaskQueue, q.blockPendPool, return q.deliver(id, q.blockTaskPool, q.blockTaskQueue, q.blockPendPool,

Loading…
Cancel
Save