Skip to content

Commit

Permalink
eth/downloader, les/downloader: fix subtle flaw in queue delivery (et…
Browse files Browse the repository at this point in the history
…hereum#25861)

* fix queue.deliver

* les/downloader: fix queue.deliver

Co-authored-by: Martin Holst Swende <martin@swende.se>
  • Loading branch information
2 people authored and blakehhuynh committed Oct 3, 2022
1 parent 84f76ca commit ad29b3d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion eth/downloader/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ func (q *queue) deliver(id string, taskPool map[common.Hash]*types.Header,
}

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)
} else {
// else: between here and above, some other peer filled this result,
Expand Down
2 changes: 1 addition & 1 deletion les/downloader/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ func (q *queue) deliver(id string, taskPool map[common.Hash]*types.Header,
}

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)
} else {
// else: between here and above, some other peer filled this result,
Expand Down

0 comments on commit ad29b3d

Please sign in to comment.