Fix condition. (#1734)

This commit is contained in:
Eugene Kabanov 2020-09-24 15:14:29 +03:00 committed by GitHub
parent 1f5b487fc6
commit 2cd0c3adaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -751,16 +751,17 @@ proc syncStep[A, B](man: SyncManager[A, B], index: int, peer: A) {.async.} =
man.notInSyncEvent.clear() man.notInSyncEvent.clear()
return return
if peerAge <= man.maxHeadAge: if headSlot >= peerSlot - man.maxHeadAge:
debug "We are in sync with peer, refreshing peer's status information", debug "We are in sync with peer, refreshing peer's status information",
wall_clock_slot = wallSlot, remote_head_slot = peerSlot, wall_clock_slot = wallSlot, remote_head_slot = peerSlot,
local_head_slot = headSlot, peer = peer, peer_score = peer.getScore(), local_head_slot = headSlot, peer = peer, peer_score = peer.getScore(),
index = index, peer_speed = peer.netKbps(), topics = "syncman" index = index, peer_speed = peer.netKbps(), topics = "syncman"
man.workers[index].status = SyncWorkerStatus.UpdatingStatus
if peerStatusAge <= StatusUpdateInterval: if peerStatusAge <= StatusUpdateInterval:
await sleepAsync(StatusUpdateInterval - peerStatusAge) await sleepAsync(StatusUpdateInterval - peerStatusAge)
man.workers[index].status = SyncWorkerStatus.UpdatingStatus
try: try:
let res = await peer.updateStatus() let res = await peer.updateStatus()
if not(res): if not(res):