diff --git a/cmd/lotus-miner/proving.go b/cmd/lotus-miner/proving.go index faae5e955a3..09f5ab2d028 100644 --- a/cmd/lotus-miner/proving.go +++ b/cmd/lotus-miner/proving.go @@ -8,11 +8,12 @@ import ( "text/tabwriter" "time" - "github.com/fatih/color" + "github.com/filecoin-project/go-address" "github.com/urfave/cli/v2" + + "github.com/fatih/color" "golang.org/x/xerrors" - "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/lotus/blockstore" "github.com/filecoin-project/lotus/chain/actors/builtin/miner" @@ -224,8 +225,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 (faults)\tproven partitions") - + _, _ = fmt.Fprintln(tw, "deadline\tpartitions\tsectors (faults|recovering|live|active)\tproven partitions") for dlIdx, deadline := range deadlines { partitions, err := api.StateMinerPartitions(ctx, maddr, uint64(dlIdx), types.EmptyTSK) if err != nil { @@ -238,29 +238,48 @@ var provingDeadlinesCmd = &cli.Command{ } sectors := uint64(0) + active := uint64(0) faults := uint64(0) + live := uint64(0) + recovering := uint64(0) for _, partition := range partitions { sc, err := partition.AllSectors.Count() if err != nil { return err } - sectors += sc - fc, err := partition.FaultySectors.Count() + ac, err := partition.ActiveSectors.Count() if err != nil { return err } + active += ac + fc, err := partition.FaultySectors.Count() + if err != nil { + return err + } faults += fc + + rc, err := partition.RecoveringSectors.Count() + if err != nil { + return err + } + recovering += rc + + lc, err := partition.LiveSectors.Count() + if err != nil { + return err + } + live += lc } var cur string if di.Index == uint64(dlIdx) { cur += "\t(current)" } - _, _ = fmt.Fprintf(tw, "%d\t%d\t%d (%d)\t%d%s\n", dlIdx, len(partitions), sectors, faults, provenPartitions, cur) + _, _ = fmt.Fprintf(tw, "%d\t%d\t%d (%d|%d|%d|%d)\t%d%s\n", dlIdx, len(partitions), sectors, faults, recovering, live, active, provenPartitions, cur) } return tw.Flush() @@ -268,8 +287,14 @@ var provingDeadlinesCmd = &cli.Command{ } var provingDeadlineInfoCmd = &cli.Command{ - Name: "deadline", - Usage: "View the current proving period deadline information by its index ", + Name: "deadline", + Usage: "View the current proving period deadline information by its index ", + Flags: []cli.Flag{ + &cli.BoolFlag{ + Name: "detailed", + Usage: "print all sector numbers", + }, + }, ArgsUsage: "", Action: func(cctx *cli.Context) error { @@ -321,12 +346,12 @@ var provingDeadlineInfoCmd = &cli.Command{ fmt.Printf("Current: %t\n\n", di.Index == dlIdx) for pIdx, partition := range partitions { - sectorCount, err := partition.AllSectors.Count() + liveSectorCount, err := partition.LiveSectors.Count() if err != nil { return err } - sectorNumbers, err := partition.AllSectors.All(sectorCount) + liveSectorNumbers, err := partition.LiveSectors.All(liveSectorCount) if err != nil { return err } @@ -342,8 +367,10 @@ var provingDeadlineInfoCmd = &cli.Command{ } fmt.Printf("Partition Index: %d\n", pIdx) - fmt.Printf("Sectors: %d\n", sectorCount) - fmt.Printf("Sector Numbers: %v\n", sectorNumbers) + fmt.Printf("Live Sectors: %d\n", liveSectorCount) + if cctx.IsSet("detailed") { + fmt.Printf("Live Sector Numbers: %v\n", liveSectorNumbers) + } fmt.Printf("Faults: %d\n", faultsCount) fmt.Printf("Faulty Sectors: %d\n", fn) } diff --git a/documentation/en/cli-lotus-miner.md b/documentation/en/cli-lotus-miner.md index 4122026f86d..74c778045ec 100644 --- a/documentation/en/cli-lotus-miner.md +++ b/documentation/en/cli-lotus-miner.md @@ -2097,6 +2097,7 @@ USAGE: lotus-miner proving deadlines [command options] [arguments...] OPTIONS: + --detailed print each partition deadlines information (default: false) --help, -h show help (default: false) ```