check recent syncs in selectSyncTarget/selectDeferredSyncTarget

This commit is contained in:
vyzo 2020-10-30 07:50:26 +02:00
parent 8d25fd39cf
commit f6ecff0e26

View File

@ -440,6 +440,10 @@ func (sm *syncManager) selectSyncTarget(done *types.TipSet) (*types.TipSet, bool
} }
} }
if sm.recent.Synced(heaviest) {
return sm.selectDeferredSyncTarget()
}
return heaviest, true, nil return heaviest, true, nil
} }
@ -451,6 +455,11 @@ deferredLoop:
bucket := sm.deferred.Pop() bucket := sm.deferred.Pop()
heaviest := bucket.heaviestTipSet() heaviest := bucket.heaviestTipSet()
if sm.recent.Synced(heaviest) {
// we have synced it or something heavier recently, skip it
continue deferredLoop
}
if sm.pend.RelatedToAny(heaviest) { if sm.pend.RelatedToAny(heaviest) {
// this has converged to a pending sync, insert it to the pending queue // this has converged to a pending sync, insert it to the pending queue
sm.pend.Insert(heaviest) sm.pend.Insert(heaviest)