@@ -52,9 +52,18 @@ func (V7SectorInfoExtractor) Extract(ctx context.Context, a actorstate.ActorInfo
5252 sectors = append (sectors , & sectorChanges .Snapped [i ].To )
5353 }
5454 }
55- sectorModel := make (minermodel.MinerSectorInfoV7List , len (sectors ))
5655
57- for i , sector := range sectors {
56+ sectorModel := make (minermodel.MinerSectorInfoV7List , 0 )
57+ // Prevent from duplicating sectors
58+ seenSectors := make (map [uint64 ]bool )
59+
60+ for _ , sector := range sectors {
61+ unit64SectorNumber := uint64 (sector .SectorNumber )
62+ if seenSectors [unit64SectorNumber ] {
63+ continue
64+ }
65+ seenSectors [unit64SectorNumber ] = true
66+
5867 sectorKeyCID := ""
5968 if sector .SectorKeyCID != nil {
6069 sectorKeyCID = sector .SectorKeyCID .String ()
@@ -85,7 +94,7 @@ func (V7SectorInfoExtractor) Extract(ctx context.Context, a actorstate.ActorInfo
8594 dailyFeeStr = dailyFee .String ()
8695 }
8796
88- sectorModel [ i ] = & minermodel.MinerSectorInfoV7 {
97+ sectorModel = append ( sectorModel , & minermodel.MinerSectorInfoV7 {
8998 Height : int64 (a .Current .Height ()),
9099 MinerID : a .Address .String (),
91100 StateRoot : a .Current .ParentState ().String (),
@@ -102,7 +111,7 @@ func (V7SectorInfoExtractor) Extract(ctx context.Context, a actorstate.ActorInfo
102111 PowerBaseEpoch : int64 (sector .PowerBaseEpoch ),
103112 SectorKeyCID : sectorKeyCID ,
104113 DailyFee : dailyFeeStr ,
105- }
114+ })
106115 }
107116
108117 return sectorModel , nil
0 commit comments