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 <[email protected]>
  • Loading branch information
2 people authored and shekhirin committed Jun 6, 2023
1 parent 69895ea commit 029f4ed
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 029f4ed

Please sign in to comment.