fix(blockexchange): handle evicted peer in download retry loop

Part of https://github.com/codex-storage/nim-codex/issues/974

Signed-off-by: Chrysostomos Nanakos <chris@include.gr>
This commit is contained in:
Chrysostomos Nanakos 2025-10-27 17:25:27 +02:00
parent ad4d3b5d62
commit ff7ac829c4
No known key found for this signature in database

View File

@ -375,7 +375,10 @@ proc downloadInternal(
let peerId = self.pendingBlocks.getRequestPeer(address).get()
self.peers.get(peerId)
assert not scheduledPeer.isNil
if scheduledPeer.isNil:
trace "Scheduled peer no longer available, clearing stale request", address
self.pendingBlocks.clearRequest(address)
continue
# Parks until either the block is received, or the peer times out.
let activityTimer = scheduledPeer.activityTimer()