Merge branch 'dev/etan/zf-branchpull' into feat/splitview

This commit is contained in:
Etan Kissling 2024-03-26 03:55:52 +01:00
commit bc58c3249f
No known key found for this signature in database
GPG Key ID: B21DA824C5A3D03D
2 changed files with 5 additions and 2 deletions

View File

@ -299,9 +299,12 @@ proc resume*(self: ref BranchDiscovery) =
proc transferOwnership*(self: ref BranchDiscovery, peer: Peer) =
const maxPeersInQueue = 10
if self.state != BranchDiscoveryState.Active or
self[].peerQueue.len >= maxPeersInQueue:
self[].peerQueue.len >= maxPeersInQueue or
peer.getHeadSlot() <= self[].getFinalizedSlot() or
self[].isBlockKnown(peer.getHeadRoot()):
self[].network.peerPool.release(peer)
return
debug "Peer transferred to branch discovery",
peer, peer_score = peer.getScore()
self[].peerQueue.addLast(peer)

View File

@ -526,7 +526,7 @@ proc syncWorker[A, B](man: SyncManager[A, B], index: int) {.async: (raises: [Can
peer = await man.pool.acquire()
await man.syncStep(index, peer)
if man.workers[index].status < SyncWorkerStatus.Downloading and
man.fallbackSyncer != nil:
peer.getScore() >= PeerScoreLowLimit and man.fallbackSyncer != nil:
# The peer was not useful for us, hand it over to the fallback syncer.
# It is the responsibility of the fallback syncer to release the peer
man.fallbackSyncer(peer)