fix --actor flag for lotus-storage-miner info
This commit is contained in:
parent
1b5797be9d
commit
ef8ab20a31
@ -24,9 +24,6 @@ import (
|
|||||||
var infoCmd = &cli.Command{
|
var infoCmd = &cli.Command{
|
||||||
Name: "info",
|
Name: "info",
|
||||||
Usage: "Print miner info",
|
Usage: "Print miner info",
|
||||||
Flags: []cli.Flag{
|
|
||||||
&cli.BoolFlag{Name: "color"},
|
|
||||||
},
|
|
||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
color.NoColor = !cctx.Bool("color")
|
color.NoColor = !cctx.Bool("color")
|
||||||
|
|
||||||
|
@ -76,6 +76,9 @@ func main() {
|
|||||||
Usage: "specify other actor to check state for (read only)",
|
Usage: "specify other actor to check state for (read only)",
|
||||||
Aliases: []string{"a"},
|
Aliases: []string{"a"},
|
||||||
},
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "color",
|
||||||
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "repo",
|
Name: "repo",
|
||||||
EnvVars: []string{"LOTUS_PATH"},
|
EnvVars: []string{"LOTUS_PATH"},
|
||||||
@ -108,6 +111,7 @@ func getActorAddress(ctx context.Context, nodeAPI api.StorageMiner, overrideMadd
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return maddr, err
|
return maddr, err
|
||||||
}
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
maddr, err = nodeAPI.ActorAddress(ctx)
|
maddr, err = nodeAPI.ActorAddress(ctx)
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/fatih/color"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
@ -32,6 +33,8 @@ var provingFaultsCmd = &cli.Command{
|
|||||||
Name: "faults",
|
Name: "faults",
|
||||||
Usage: "View the currently known proving faulty sectors information",
|
Usage: "View the currently known proving faulty sectors information",
|
||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
|
color.NoColor = !cctx.Bool("color")
|
||||||
|
|
||||||
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
|
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -66,6 +69,8 @@ var provingFaultsCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Printf("Miner: %s\n", color.BlueString("%s", maddr))
|
||||||
|
|
||||||
head, err := api.ChainHead(ctx)
|
head, err := api.ChainHead(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("getting chain head: %w", err)
|
return xerrors.Errorf("getting chain head: %w", err)
|
||||||
@ -101,6 +106,8 @@ var provingInfoCmd = &cli.Command{
|
|||||||
Name: "info",
|
Name: "info",
|
||||||
Usage: "View current state information",
|
Usage: "View current state information",
|
||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
|
color.NoColor = !cctx.Bool("color")
|
||||||
|
|
||||||
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
|
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -135,6 +142,8 @@ var provingInfoCmd = &cli.Command{
|
|||||||
return xerrors.Errorf("getting miner deadlines: %w", err)
|
return xerrors.Errorf("getting miner deadlines: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Printf("Miner: %s\n", color.BlueString("%s", maddr))
|
||||||
|
|
||||||
var mas miner.State
|
var mas miner.State
|
||||||
{
|
{
|
||||||
mact, err := api.StateGetActor(ctx, maddr, types.EmptyTSK)
|
mact, err := api.StateGetActor(ctx, maddr, types.EmptyTSK)
|
||||||
@ -240,6 +249,8 @@ var provingDeadlinesCmd = &cli.Command{
|
|||||||
Name: "deadlines",
|
Name: "deadlines",
|
||||||
Usage: "View the current proving period deadlines information",
|
Usage: "View the current proving period deadlines information",
|
||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
|
color.NoColor = !cctx.Bool("color")
|
||||||
|
|
||||||
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
|
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -284,6 +295,8 @@ var provingDeadlinesCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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\tproven")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user