From 3086c256c932dc6da26822a5ec130c2fba7e222e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Thu, 9 Feb 2023 14:56:15 +0200 Subject: [PATCH] eth/downloader: fix timeout resurrection panic (#26652) * common/prque, eth/downloader: fix timeout resurrection panic * common/prque: revert -1 hack for les, temporaryly! --- eth/downloader/fetchers_concurrent.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eth/downloader/fetchers_concurrent.go b/eth/downloader/fetchers_concurrent.go index ceec06de4f..649aa27615 100644 --- a/eth/downloader/fetchers_concurrent.go +++ b/eth/downloader/fetchers_concurrent.go @@ -280,13 +280,14 @@ func (d *Downloader) concurrentFetch(queue typedQueue, beaconMode bool) error { // overloading it further. delete(pending, req.Peer) stales[req.Peer] = req - delete(ordering, req) - timeouts.Pop() + timeouts.Pop() // Popping an item will reorder indices in `ordering`, delete after, otherwise will resurrect! if timeouts.Size() > 0 { _, exp := timeouts.Peek() timeout.Reset(time.Until(time.Unix(0, -exp))) } + delete(ordering, req) + // New timeout potentially set if there are more requests pending, // reschedule the failed one to a free peer fails := queue.unreserve(req.Peer)