cli: state: --cids flag for list-messages

This commit is contained in:
Łukasz Magiera 2020-01-21 23:53:23 +01:00
parent 882507e915
commit bfb1cc6379

View File

@ -535,6 +535,10 @@ var stateListMessagesCmd = &cli.Command{
Name: "toheight", Name: "toheight",
Usage: "don't look before given block height", Usage: "don't look before given block height",
}, },
&cli.BoolFlag{
Name: "cids",
Usage: "print message CIDs instead of messages",
},
}, },
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
api, closer, err := GetFullNodeAPI(cctx) api, closer, err := GetFullNodeAPI(cctx)
@ -575,6 +579,11 @@ var stateListMessagesCmd = &cli.Command{
} }
for _, c := range msgs { for _, c := range msgs {
if cctx.Bool("cids") {
fmt.Println(c.String())
continue
}
m, err := api.ChainGetMessage(ctx, c) m, err := api.ChainGetMessage(ctx, c)
if err != nil { if err != nil {
return err return err