Skip to content

Commit 5d1b4da

Browse files
authored
fix: dup (#1367)
* fix: dup * feat: change the fail condition
1 parent de36930 commit 5d1b4da

3 files changed

Lines changed: 19 additions & 7 deletions

File tree

chain/indexer/integrated/manager.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ func (i *Manager) TipSet(ctx context.Context, ts *types.TipSet, options ...index
142142
grp.Go(func() error {
143143
fatals := []error{}
144144
for fatal := range taskErrors {
145-
success.Store(false)
146145
fatals = append(fatals, fatal)
147146
}
148147
if len(fatals) > 0 {

tasks/actorstate/miner/sectorv7.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

tasks/messageexecutions/vm/task.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ func (t *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, execut
8181
}
8282

8383
var (
84-
vmMessageResults = make(messagemodel.VMMessageList, 0, len(mex))
84+
vmMessageResults = make(messagemodel.VMMessageList, 0)
8585
errorsDetected = make([]*messages.MessageError, 0)
86+
cidIndexMap = make(map[string]uint64)
8687
)
8788
for _, parentMsg := range mex {
8889
select {
@@ -115,6 +116,9 @@ func (t *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, execut
115116
}
116117
childCid := childMsg.Cid()
117118

119+
index := cidIndexMap[childCid.String()]
120+
cidIndexMap[childCid.String()]++
121+
118122
toCode, found := getActorCode(ctx, child.Message.To)
119123
if !found && child.Receipt.ExitCode == 0 {
120124
// No destination actor code. Normally Lotus will create an account actor for unknown addresses but if the
@@ -148,7 +152,7 @@ func (t *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, execut
148152
ExitCode: int64(child.Receipt.ExitCode),
149153
ActorCode: toActorCode,
150154
Method: uint64(child.Message.Method),
151-
Index: child.Index,
155+
Index: index,
152156
// Params will be filled below if exit code is non-zero
153157
// Return will be filled below if exit code is non-zero
154158
}

0 commit comments

Comments
 (0)