More than one bucket

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2020-10-21 22:52:35 +02:00
parent febc28f83f
commit 5edfc527b0
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA

View File

@ -199,13 +199,18 @@ func (sbs *syncBucketSet) removeBucket(toremove *syncTargetBucket) {
} }
func (sbs *syncBucketSet) PopRelated(ts *types.TipSet) *syncTargetBucket { func (sbs *syncBucketSet) PopRelated(ts *types.TipSet) *syncTargetBucket {
var bOut *syncTargetBucket
for _, b := range sbs.buckets { for _, b := range sbs.buckets {
if b.sameChainAs(ts) { if b.sameChainAs(ts) {
sbs.removeBucket(b) if bOut == nil {
return b sbs.removeBucket(b)
bOut = b
} else {
log.Errorf("REPORT THIS more that one related bucket for %s", ts)
}
} }
} }
return nil return bOut
} }
func (sbs *syncBucketSet) Heaviest() *types.TipSet { func (sbs *syncBucketSet) Heaviest() *types.TipSet {
@ -312,7 +317,7 @@ func (sm *syncManager) syncScheduler() {
log.Info("sync scheduler shutting down") log.Info("sync scheduler shutting down")
return return
case <-t.C: case <-t.C:
activeSyncs := make([]types.TipSetKey, len(sm.activeSyncs), 0) activeSyncs := make([]types.TipSetKey, 0, len(sm.activeSyncs))
for tsk := range sm.activeSyncs { for tsk := range sm.activeSyncs {
activeSyncs = append(activeSyncs, tsk) activeSyncs = append(activeSyncs, tsk)
} }