Better miner proving deadlines

This commit is contained in:
Łukasz Magiera 2020-07-27 18:15:47 +02:00
parent d557c407c6
commit 0adfd68fae

View File

@ -298,7 +298,7 @@ var provingDeadlinesCmd = &cli.Command{
fmt.Printf("Miner: %s\n", color.BlueString("%s", maddr)) fmt.Printf("Miner: %s\n", color.BlueString("%s", maddr))
tw := tabwriter.NewWriter(os.Stdout, 2, 4, 2, ' ', 0) 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 { for dlIdx, deadline := range deadlines {
partitions, err := api.StateMinerPartitions(ctx, maddr, uint64(dlIdx), types.EmptyTSK) partitions, err := api.StateMinerPartitions(ctx, maddr, uint64(dlIdx), types.EmptyTSK)
@ -311,11 +311,30 @@ var provingDeadlinesCmd = &cli.Command{
return err 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 var cur string
if di.Index == uint64(dlIdx) { if di.Index == uint64(dlIdx) {
cur += "\t(current)" 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() return tw.Flush()