Skip to content

Commit 7ea3760

Browse files
karalabeshekhirin
authored andcommitted
eth/downloader: fix timeout resurrection panic (ethereum#26652)
* common/prque, eth/downloader: fix timeout resurrection panic * common/prque: revert -1 hack for les, temporaryly!
1 parent 43f205b commit 7ea3760

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

eth/downloader/fetchers_concurrent.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,13 +280,14 @@ func (d *Downloader) concurrentFetch(queue typedQueue, beaconMode bool) error {
280280
// overloading it further.
281281
delete(pending, req.Peer)
282282
stales[req.Peer] = req
283-
delete(ordering, req)
284283

285-
timeouts.Pop()
284+
timeouts.Pop() // Popping an item will reorder indices in `ordering`, delete after, otherwise will resurrect!
286285
if timeouts.Size() > 0 {
287286
_, exp := timeouts.Peek()
288287
timeout.Reset(time.Until(time.Unix(0, -exp)))
289288
}
289+
delete(ordering, req)
290+
290291
// New timeout potentially set if there are more requests pending,
291292
// reschedule the failed one to a free peer
292293
fails := queue.unreserve(req.Peer)

0 commit comments

Comments
 (0)