Skip to content

Commit

Permalink
fix: storage: only check CommD if sector has deals
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek committed Sep 23, 2023
1 parent e64c09d commit 43b7ef7
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions storage/pipeline/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,15 @@ func checkPrecommit(ctx context.Context, maddr address.Address, si SectorInfo, t
return err
}

commD, err := api.StateComputeDataCID(ctx, maddr, si.SectorType, si.dealIDs(), tsk)
if err != nil {
return &ErrApi{xerrors.Errorf("calling StateComputeDataCommitment: %w", err)}
}
if si.hasDeals() {
commD, err := api.StateComputeDataCID(ctx, maddr, si.SectorType, si.dealIDs(), tsk)
if err != nil {
return &ErrApi{xerrors.Errorf("calling StateComputeDataCommitment: %w", err)}
}

if si.CommD == nil || !commD.Equals(*si.CommD) {
return &ErrBadCommD{xerrors.Errorf("on chain CommD differs from sector: %s != %s", commD, si.CommD)}
if si.CommD == nil || !commD.Equals(*si.CommD) {
return &ErrBadCommD{xerrors.Errorf("on chain CommD differs from sector: %s != %s", commD, si.CommD)}
}
}

pci, err := api.StateSectorPreCommitInfo(ctx, maddr, si.SectorNumber, tsk)
Expand Down

0 comments on commit 43b7ef7

Please sign in to comment.