From 43b7ef7ea41b63bf076445968b417241586a4cd8 Mon Sep 17 00:00:00 2001 From: Aayush Date: Sat, 23 Sep 2023 17:51:39 -0400 Subject: [PATCH] fix: storage: only check CommD if sector has deals --- storage/pipeline/checks.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/storage/pipeline/checks.go b/storage/pipeline/checks.go index b243804cc0e..ecd160231c1 100644 --- a/storage/pipeline/checks.go +++ b/storage/pipeline/checks.go @@ -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)