lotus/cli/miner.go

44 lines
719 B
Go
Raw Normal View History

2019-07-11 02:36:43 +00:00
package cli
import (
"fmt"
2019-08-16 19:39:09 +00:00
"github.com/filecoin-project/go-lotus/chain/address"
2019-07-11 02:36:43 +00:00
"gopkg.in/urfave/cli.v2"
)
var minerCmd = &cli.Command{
Name: "miner",
Usage: "Manage mining",
Subcommands: []*cli.Command{
minerStart,
},
}
var minerStart = &cli.Command{
Name: "start",
Usage: "start mining",
Action: func(cctx *cli.Context) error {
2019-08-02 16:18:44 +00:00
api, err := GetFullNodeAPI(cctx)
2019-07-12 04:09:04 +00:00
if err != nil {
return err
}
2019-07-18 23:16:23 +00:00
ctx := ReqContext(cctx)
2019-07-11 02:36:43 +00:00
2019-08-16 19:39:09 +00:00
// TODO: need to pull this from disk or something
maddr, err := address.NewFromString(cctx.Args().First())
2019-07-11 02:36:43 +00:00
if err != nil {
2019-07-26 16:14:01 +00:00
return err
2019-07-11 02:36:43 +00:00
}
if err := api.MinerStart(ctx, maddr); err != nil {
return err
}
fmt.Println("started mining")
return nil
},
}