Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: lid recovery #1906

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions cmd/boostd/recover.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,12 @@ func action(cctx *cli.Context) error {
return err
}

sectors, err := fullnodeApi.StateMinerSectors(ctx, maddr, nil, types.EmptyTSK)
head, err := fullnodeApi.ChainHead(ctx)
if err != nil {
return err
}

sectors, err := fullnodeApi.StateMinerSectors(ctx, maddr, nil, head.Key())
if err != nil {
return err
}
Expand All @@ -237,6 +242,11 @@ func action(cctx *cli.Context) error {
continue
}

if info.Expiration < head.Height() {
logger.Infof("ignoring expired sector %d", info.SectorNumber)
continue
}

if len(info.DealIDs) < 1 {
logger.Infow("no deals in sector", "sector", info.SectorNumber)

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

ok, isUnsealed, err := processSector(ctx, info)
ok, isUnsealed, err := processSector(ctx, head.Key(), info)
if err != nil {
return err
}
Expand Down Expand Up @@ -671,7 +681,7 @@ func processPiece(ctx context.Context, sectorid abi.SectorNumber, chainDealID ab
return nil
}

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

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

nextoffset := uint64(0)
for _, did := range info.DealIDs {
marketDeal, err := fullnodeApi.StateMarketStorageDeal(ctx, did, types.EmptyTSK)
marketDeal, err := fullnodeApi.StateMarketStorageDeal(ctx, did, key)
if err != nil {
if strings.Contains(err.Error(), "not found") {
logger.Warnw("deal present in sector, but not in market actor state, so probably expired", "sector", sectorid, "deal", did, "err", err)
Expand Down
Loading