eth/downloader: use batch index in deliver reconstruct (#34870)

The reconstruct callback indexes parallel response slices (bodies,
receipts). Passing the accept counter used the wrong element when an
earlier header in the same batch hit a stale slot.
This commit is contained in:
cui 2026-05-05 18:41:22 +08:00 committed by GitHub
parent d5edb80438
commit 5b837e5786
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -689,9 +689,9 @@ func (q *queue) deliver(id string, taskPool map[common.Hash]*types.Header,
i++ i++
} }
for _, header := range request.Headers[:i] { for k, header := range request.Headers[:i] {
if res, stale, err := q.resultCache.GetDeliverySlot(header.Number.Uint64()); err == nil && !stale { if res, stale, err := q.resultCache.GetDeliverySlot(header.Number.Uint64()); err == nil && !stale {
reconstruct(accepted, res) reconstruct(k, res)
accepted++ accepted++
} else { } else {
// Between here and above, some other peer filled this result, // Between here and above, some other peer filled this result,