Skip to content

Commit b32d203

Browse files
zhiqiangxuholiman
andauthored
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 <[email protected]>
1 parent e004e7d commit b32d203

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

eth/downloader/queue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ func (q *queue) deliver(id string, taskPool map[common.Hash]*types.Header,
857857
}
858858

859859
for _, header := range request.Headers[:i] {
860-
if res, stale, err := q.resultCache.GetDeliverySlot(header.Number.Uint64()); err == nil {
860+
if res, stale, err := q.resultCache.GetDeliverySlot(header.Number.Uint64()); err == nil && !stale {
861861
reconstruct(accepted, res)
862862
} else {
863863
// else: between here and above, some other peer filled this result,

les/downloader/queue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ func (q *queue) deliver(id string, taskPool map[common.Hash]*types.Header,
870870
}
871871

872872
for _, header := range request.Headers[:i] {
873-
if res, stale, err := q.resultCache.GetDeliverySlot(header.Number.Uint64()); err == nil {
873+
if res, stale, err := q.resultCache.GetDeliverySlot(header.Number.Uint64()); err == nil && !stale {
874874
reconstruct(accepted, res)
875875
} else {
876876
// else: between here and above, some other peer filled this result,

0 commit comments

Comments
 (0)