Skip to content

Commit 7ea3377

Browse files
authored
ignore expired sectors (#1906)
1 parent 0a73921 commit 7ea3377

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

cmd/boostd/recover.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,12 @@ func action(cctx *cli.Context) error {
218218
return err
219219
}
220220

221-
sectors, err := fullnodeApi.StateMinerSectors(ctx, maddr, nil, types.EmptyTSK)
221+
head, err := fullnodeApi.ChainHead(ctx)
222+
if err != nil {
223+
return err
224+
}
225+
226+
sectors, err := fullnodeApi.StateMinerSectors(ctx, maddr, nil, head.Key())
222227
if err != nil {
223228
return err
224229
}
@@ -237,6 +242,11 @@ func action(cctx *cli.Context) error {
237242
continue
238243
}
239244

245+
if info.Expiration < head.Height() {
246+
logger.Infof("ignoring expired sector %d", info.SectorNumber)
247+
continue
248+
}
249+
240250
if len(info.DealIDs) < 1 {
241251
logger.Infow("no deals in sector", "sector", info.SectorNumber)
242252

@@ -257,7 +267,7 @@ func action(cctx *cli.Context) error {
257267
continue
258268
}
259269

260-
ok, isUnsealed, err := processSector(ctx, info)
270+
ok, isUnsealed, err := processSector(ctx, head.Key(), info)
261271
if err != nil {
262272
return err
263273
}
@@ -671,7 +681,7 @@ func processPiece(ctx context.Context, sectorid abi.SectorNumber, chainDealID ab
671681
return nil
672682
}
673683

674-
func processSector(ctx context.Context, info *miner.SectorOnChainInfo) (bool, bool, error) { // ok, isUnsealed, error
684+
func processSector(ctx context.Context, key types.TipSetKey, info *miner.SectorOnChainInfo) (bool, bool, error) { // ok, isUnsealed, error
675685
logger.Debugw("processing sector", "sector", info.SectorNumber, "deals", info.DealIDs)
676686

677687
sectorid := info.SectorNumber
@@ -698,7 +708,7 @@ func processSector(ctx context.Context, info *miner.SectorOnChainInfo) (bool, bo
698708

699709
nextoffset := uint64(0)
700710
for _, did := range info.DealIDs {
701-
marketDeal, err := fullnodeApi.StateMarketStorageDeal(ctx, did, types.EmptyTSK)
711+
marketDeal, err := fullnodeApi.StateMarketStorageDeal(ctx, did, key)
702712
if err != nil {
703713
if strings.Contains(err.Error(), "not found") {
704714
logger.Warnw("deal present in sector, but not in market actor state, so probably expired", "sector", sectorid, "deal", did, "err", err)

0 commit comments

Comments
 (0)