mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-01-07 16:03:13 +00:00
fix: decrease block retry count when no peers found
There is a limitation in `downloadInternal` that infinitely loops for peers when attempting to download a block if the node does not have peers. Currently, the block retry counter is only decremented if there exists peers and a download attempt is made, otherwise the loop will continue until peers are found, ad infinium. This fix decrements the retry counter on each loop that no peers are found.
This commit is contained in:
parent
46413c8dff
commit
e47186db90
@ -371,6 +371,12 @@ proc downloadInternal(
|
|||||||
break
|
break
|
||||||
# If we still don't have the block, we'll go for another cycle.
|
# If we still don't have the block, we'll go for another cycle.
|
||||||
trace "No peers for block, will retry shortly"
|
trace "No peers for block, will retry shortly"
|
||||||
|
# Without decremeting the retries count, this would infinitely loop
|
||||||
|
# trying to find peers.
|
||||||
|
self.pendingBlocks.decRetries(address)
|
||||||
|
# `searchForNewPeers` will do nothing if DiscoveryRateLimit has not
|
||||||
|
# elapsed, so we should wait to avoid a noop
|
||||||
|
await sleepAsync(DiscoveryRateLimit)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Once again, it might happen that the block was requested to a peer
|
# Once again, it might happen that the block was requested to a peer
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user