diff --git a/cmd/lotus-miner/proving.go b/cmd/lotus-miner/proving.go index 8b3bde610..51149baf6 100644 --- a/cmd/lotus-miner/proving.go +++ b/cmd/lotus-miner/proving.go @@ -304,6 +304,14 @@ var provingDeadlineInfoCmd = &cli.Command{ Name: "deadline", Usage: "View the current proving period deadline information by its index ", ArgsUsage: "", + Flags: []cli.Flag{ + &cli.BoolFlag{ + Name: "live", + Usage: "View deadline live sectors", + Value: false, + Aliases: []string{"l"}, + }, + }, Action: func(cctx *cli.Context) error { if cctx.Args().Len() != 1 { @@ -353,33 +361,64 @@ var provingDeadlineInfoCmd = &cli.Command{ fmt.Printf("Proven Partitions: %d\n", provenPartitions) fmt.Printf("Current: %t\n\n", di.Index == dlIdx) - for pIdx, partition := range partitions { - sectorCount, err := partition.AllSectors.Count() - if err != nil { - return err - } + if !cctx.Bool("live") { + for pIdx, partition := range partitions { + sectorCount, err := partition.AllSectors.Count() + if err != nil { + return err + } - sectorNumbers, err := partition.AllSectors.All(sectorCount) - if err != nil { - return err - } + sectorNumbers, err := partition.AllSectors.All(sectorCount) + if err != nil { + return err + } - faultsCount, err := partition.FaultySectors.Count() - if err != nil { - return err - } + faultsCount, err := partition.FaultySectors.Count() + if err != nil { + return err + } - fn, err := partition.FaultySectors.All(faultsCount) - if err != nil { - return err - } + fn, err := partition.FaultySectors.All(faultsCount) + if err != nil { + return err + } - fmt.Printf("Partition Index: %d\n", pIdx) - fmt.Printf("Sectors: %d\n", sectorCount) - fmt.Printf("Sector Numbers: %v\n", sectorNumbers) - fmt.Printf("Faults: %d\n", faultsCount) - fmt.Printf("Faulty Sectors: %d\n", fn) + fmt.Printf("Partition Index: %d\n", pIdx) + fmt.Printf("Sectors: %d\n", sectorCount) + fmt.Printf("Sector Numbers: %v\n", sectorNumbers) + fmt.Printf("Faults: %d\n", faultsCount) + fmt.Printf("Faulty Sectors: %d\n", fn) + } + } else { + for pIdx, partition := range partitions { + sectorCount, err := partition.LiveSectors.Count() + if err != nil { + return err + } + + sectorNumbers, err := partition.LiveSectors.All(sectorCount) + if err != nil { + return err + } + + faultsCount, err := partition.FaultySectors.Count() + if err != nil { + return err + } + + fn, err := partition.FaultySectors.All(faultsCount) + if err != nil { + return err + } + + fmt.Printf("Partition Index: %d\n", pIdx) + fmt.Printf("Sectors: %d\n", sectorCount) + fmt.Printf("Sector Numbers: %v\n", sectorNumbers) + fmt.Printf("Faults: %d\n", faultsCount) + fmt.Printf("Faulty Sectors: %d\n", fn) + } } + return nil }, }