eth/downloader: use batch index in deliver reconstruct

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 failed validation or hit a stale slot.
This commit is contained in:
Weixie Cui 2026-05-04 22:49:07 +08:00
parent f0b21fa110
commit 3366ae8a96

View file

@ -689,9 +689,9 @@ func (q *queue) deliver(id string, taskPool map[common.Hash]*types.Header,
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 {
reconstruct(accepted, res)
reconstruct(k, res)
accepted++
} else {
// Between here and above, some other peer filled this result,