From 2514c96cffc982ec1f46b85c83d2cbef4d08a8fa Mon Sep 17 00:00:00 2001 From: Peter Rabbitson Date: Thu, 3 Dec 2020 19:15:55 +0000 Subject: [PATCH] Count deals from sealed sectors only --- cmd/lotus-shed/sr2-dealstats-rollup.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cmd/lotus-shed/sr2-dealstats-rollup.go b/cmd/lotus-shed/sr2-dealstats-rollup.go index bba1d71c6f..9959fb1e03 100644 --- a/cmd/lotus-shed/sr2-dealstats-rollup.go +++ b/cmd/lotus-shed/sr2-dealstats-rollup.go @@ -245,11 +245,13 @@ var rollupDealStatsCmd = &cli.Command{ for dealID, dealInfo := range deals { - // Counting no-longer-active deals as per Pooja's request - // // https://github.com/filecoin-project/specs-actors/blob/v0.9.9/actors/builtin/market/deal.go#L81-L85 - // if d.State.SectorStartEpoch < 0 { - // continue - // } + // Only count deals that have properly started, not past/future ones + // https://github.com/filecoin-project/specs-actors/blob/v0.9.9/actors/builtin/market/deal.go#L81-L85 + // Bail on 0 as well in case SectorStartEpoch is uninitialized due to some bug + if dealInfo.State.SectorStartEpoch <= 0 || + dealInfo.State.SectorStartEpoch > head.Height() { + continue + } clientAddr, found := resolvedWallets[dealInfo.Proposal.Client] if !found {