Skip to content

Commit

Permalink
refactor miner info command.
Browse files Browse the repository at this point in the history
  • Loading branch information
raulk committed Jul 29, 2021
1 parent 7d6eb25 commit f27a71c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
1 change: 0 additions & 1 deletion cli/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ var AuthApiInfoToken = &cli.Command{

// TODO: Log in audit log when it is implemented

// WARN: this is unable to tell
currentEnv, _ := cliutil.EnvsForRepo(t)
fmt.Printf("%s=%s:%s\n", currentEnv, string(token), ainfo.Addr)
return nil
Expand Down
35 changes: 22 additions & 13 deletions cmd/lotus-miner/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ var infoCmd = &cli.Command{
}

func infoCmdAct(cctx *cli.Context) error {
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
minerApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err
}
defer closer()

marketsApi, closer, err := lcli.GetMarketsAPI(cctx)
if err != nil {
return err
}
Expand All @@ -64,12 +70,19 @@ func infoCmdAct(cctx *cli.Context) error {

ctx := lcli.ReqContext(cctx)

subsystems, err := nodeApi.RuntimeSubsystems(ctx)
subsystems, err := minerApi.RuntimeSubsystems(ctx)
if err != nil {
return err
}

fmt.Println("Enabled subsystems (from miner API):", subsystems)

subsystems, err = marketsApi.RuntimeSubsystems(ctx)
if err != nil {
return err
}

fmt.Println("Enabled subsystems:", subsystems)
fmt.Println("Enabled subsystems (from markets API):", subsystems)

fmt.Print("Chain: ")

Expand Down Expand Up @@ -103,18 +116,14 @@ func infoCmdAct(cctx *cli.Context) error {

fmt.Println()

if subsystems.Has(api.SubsystemSectorStorage) {
err := handleMiningInfo(ctx, cctx, fullapi, nodeApi)
if err != nil {
return err
}
err = handleMiningInfo(ctx, cctx, fullapi, minerApi)
if err != nil {
return err
}

if subsystems.Has(api.SubsystemMarkets) {
err := handleMarketsInfo(ctx, nodeApi)
if err != nil {
return err
}
err = handleMarketsInfo(ctx, marketsApi)
if err != nil {
return err
}

return nil
Expand Down

0 comments on commit f27a71c

Please sign in to comment.