Merge pull request #5957 from filecoin-project/asr/nits

State CLI improvements
This commit is contained in:
Łukasz Magiera 2021-04-05 18:09:01 +02:00 committed by GitHub
commit 0a8d20eb4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1464,7 +1464,12 @@ func printReceiptReturn(ctx context.Context, api api.FullNode, m *types.Message,
}
func printMsg(ctx context.Context, api api.FullNode, msg cid.Cid, mw *lapi.MsgLookup, m *types.Message) error {
if mw != nil {
if mw == nil {
fmt.Println("message was not found on chain")
return nil
}
if mw.Message != msg {
fmt.Printf("Message was replaced: %s\n", mw.Message)
}
@ -1473,10 +1478,6 @@ func printMsg(ctx context.Context, api api.FullNode, msg cid.Cid, mw *lapi.MsgLo
fmt.Printf("Exit Code: %d\n", mw.Receipt.ExitCode)
fmt.Printf("Gas Used: %d\n", mw.Receipt.GasUsed)
fmt.Printf("Return: %x\n", mw.Receipt.Return)
} else {
fmt.Println("message was not found on chain")
}
if err := printReceiptReturn(ctx, api, m, mw.Receipt); err != nil {
return err
}
@ -1744,7 +1745,7 @@ var StateCircSupplyCmd = &cli.Command{
var StateSectorCmd = &cli.Command{
Name: "sector",
Usage: "Get miner sector info",
ArgsUsage: "[miner address] [sector number]",
ArgsUsage: "[minerAddress] [sectorNumber]",
Action: func(cctx *cli.Context) error {
api, closer, err := GetFullNodeAPI(cctx)
if err != nil {
@ -1755,7 +1756,7 @@ var StateSectorCmd = &cli.Command{
ctx := ReqContext(cctx)
if cctx.Args().Len() != 2 {
return xerrors.Errorf("expected 2 params")
return xerrors.Errorf("expected 2 params: minerAddress and sectorNumber")
}
ts, err := LoadTipSet(ctx, cctx, api)