Merge branch 'dev/etan/zf-branchpull' into feat/splitview
This commit is contained in:
commit
bc58c3249f
|
@ -299,9 +299,12 @@ proc resume*(self: ref BranchDiscovery) =
|
||||||
proc transferOwnership*(self: ref BranchDiscovery, peer: Peer) =
|
proc transferOwnership*(self: ref BranchDiscovery, peer: Peer) =
|
||||||
const maxPeersInQueue = 10
|
const maxPeersInQueue = 10
|
||||||
if self.state != BranchDiscoveryState.Active or
|
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)
|
self[].network.peerPool.release(peer)
|
||||||
return
|
return
|
||||||
|
|
||||||
debug "Peer transferred to branch discovery",
|
debug "Peer transferred to branch discovery",
|
||||||
peer, peer_score = peer.getScore()
|
peer, peer_score = peer.getScore()
|
||||||
self[].peerQueue.addLast(peer)
|
self[].peerQueue.addLast(peer)
|
||||||
|
|
|
@ -526,7 +526,7 @@ proc syncWorker[A, B](man: SyncManager[A, B], index: int) {.async: (raises: [Can
|
||||||
peer = await man.pool.acquire()
|
peer = await man.pool.acquire()
|
||||||
await man.syncStep(index, peer)
|
await man.syncStep(index, peer)
|
||||||
if man.workers[index].status < SyncWorkerStatus.Downloading and
|
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.
|
# 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
|
# It is the responsibility of the fallback syncer to release the peer
|
||||||
man.fallbackSyncer(peer)
|
man.fallbackSyncer(peer)
|
||||||
|
|
Loading…
Reference in New Issue