From 0adfd68faeec87f4c74d8506cba2840c1fed53d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 27 Jul 2020 18:15:47 +0200 Subject: [PATCH] Better miner proving deadlines --- cmd/lotus-storage-miner/proving.go | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/cmd/lotus-storage-miner/proving.go b/cmd/lotus-storage-miner/proving.go index c6cfcaf30..85379a748 100644 --- a/cmd/lotus-storage-miner/proving.go +++ b/cmd/lotus-storage-miner/proving.go @@ -298,7 +298,7 @@ var provingDeadlinesCmd = &cli.Command{ fmt.Printf("Miner: %s\n", color.BlueString("%s", maddr)) tw := tabwriter.NewWriter(os.Stdout, 2, 4, 2, ' ', 0) - _, _ = fmt.Fprintln(tw, "deadline\tpartitions\tsectors\tproven") + _, _ = fmt.Fprintln(tw, "deadline\tpartitions\tsectors (faults)\tproven partitions") for dlIdx, deadline := range deadlines { partitions, err := api.StateMinerPartitions(ctx, maddr, uint64(dlIdx), types.EmptyTSK) @@ -311,11 +311,30 @@ var provingDeadlinesCmd = &cli.Command{ return err } + sectors := uint64(0) + faults := uint64(0) + + for _, partition := range partitions { + sc, err := partition.Sectors.Count() + if err != nil { + return err + } + + sectors += sc + + fc, err := partition.Faults.Count() + if err != nil { + return err + } + + faults += fc + } + var cur string if di.Index == uint64(dlIdx) { cur += "\t(current)" } - _, _ = fmt.Fprintf(tw, "%d\t%d\t%d%s\n", dlIdx, len(partitions), provenPartitions, cur) + _, _ = fmt.Fprintf(tw, "%d\t%d\t%d (%d)\t%d%s\n", dlIdx, len(partitions), sectors, faults, provenPartitions, cur) } return tw.Flush()