eth/downloader, les/downloader: fix subtle flaw in queue delivery (#25861)

* fix queue.deliver

* les/downloader: fix queue.deliver

Co-authored-by: Martin Holst Swende <martin@swende.se>
pull/25844/head
zhiqiangxu 2 years ago committed by GitHub
parent e004e7d256
commit b32d20324e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      eth/downloader/queue.go
  2. 2
      les/downloader/queue.go

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

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

Loading…
Cancel
Save