@@ -218,7 +218,12 @@ func action(cctx *cli.Context) error {
218
218
return err
219
219
}
220
220
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 ())
222
227
if err != nil {
223
228
return err
224
229
}
@@ -237,6 +242,11 @@ func action(cctx *cli.Context) error {
237
242
continue
238
243
}
239
244
245
+ if info .Expiration < head .Height () {
246
+ logger .Infof ("ignoring expired sector %d" , info .SectorNumber )
247
+ continue
248
+ }
249
+
240
250
if len (info .DealIDs ) < 1 {
241
251
logger .Infow ("no deals in sector" , "sector" , info .SectorNumber )
242
252
@@ -257,7 +267,7 @@ func action(cctx *cli.Context) error {
257
267
continue
258
268
}
259
269
260
- ok , isUnsealed , err := processSector (ctx , info )
270
+ ok , isUnsealed , err := processSector (ctx , head . Key (), info )
261
271
if err != nil {
262
272
return err
263
273
}
@@ -671,7 +681,7 @@ func processPiece(ctx context.Context, sectorid abi.SectorNumber, chainDealID ab
671
681
return nil
672
682
}
673
683
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
675
685
logger .Debugw ("processing sector" , "sector" , info .SectorNumber , "deals" , info .DealIDs )
676
686
677
687
sectorid := info .SectorNumber
@@ -698,7 +708,7 @@ func processSector(ctx context.Context, info *miner.SectorOnChainInfo) (bool, bo
698
708
699
709
nextoffset := uint64 (0 )
700
710
for _ , did := range info .DealIDs {
701
- marketDeal , err := fullnodeApi .StateMarketStorageDeal (ctx , did , types . EmptyTSK )
711
+ marketDeal , err := fullnodeApi .StateMarketStorageDeal (ctx , did , key )
702
712
if err != nil {
703
713
if strings .Contains (err .Error (), "not found" ) {
704
714
logger .Warnw ("deal present in sector, but not in market actor state, so probably expired" , "sector" , sectorid , "deal" , did , "err" , err )
0 commit comments