lotus/cli/chain.go
Whyrusleeping 3f61488e3c
Merge pull request #17 from filecoin-project/feat/mining-1
Implement basic mining logic
2019-07-11 10:09:15 -07:00

38 lines
557 B
Go

package cli
import (
"fmt"
"gopkg.in/urfave/cli.v2"
)
var chainCmd = &cli.Command{
Name: "chain",
Usage: "Interact with filecoin blockchain",
Subcommands: []*cli.Command{
chainHeadCmd,
},
}
var chainHeadCmd = &cli.Command{
Name: "head",
Usage: "Print chain head",
Action: func(cctx *cli.Context) error {
api, err := getAPI(cctx)
if err != nil {
return err
}
ctx := reqContext(cctx)
head, err := api.ChainHead(ctx)
if err != nil {
return err
}
for _, c := range head.Cids() {
fmt.Println(c)
}
return nil
},
}