(ctx *cli.Context)
| 92 | } |
| 93 | |
| 94 | func blockInfo(ctx *cli.Context) error { |
| 95 | SetRpcPort(ctx) |
| 96 | if ctx.NArg() < 1 { |
| 97 | PrintErrorMsg("Missing argument,BlockHash or height expected.") |
| 98 | cli.ShowSubcommandHelp(ctx) |
| 99 | return nil |
| 100 | } |
| 101 | |
| 102 | var data []byte |
| 103 | var err error |
| 104 | var height int64 |
| 105 | arg := ctx.Args().First() |
| 106 | if len(arg) > 30 { |
| 107 | data, err = utils.GetBlock(arg) |
| 108 | if err != nil { |
| 109 | return fmt.Errorf("GetBlock error:%s", err) |
| 110 | } |
| 111 | } else { |
| 112 | height, err = strconv.ParseInt(arg, 10, 64) |
| 113 | if err != nil { |
| 114 | return fmt.Errorf("arg:%s invalid block hash or block height", arg) |
| 115 | } |
| 116 | data, err = utils.GetBlock(height) |
| 117 | if err != nil { |
| 118 | return fmt.Errorf("GetBlock error:%s", err) |
| 119 | } |
| 120 | } |
| 121 | PrintJsonData(data) |
| 122 | return nil |
| 123 | } |
| 124 | |
| 125 | func txInfo(ctx *cli.Context) error { |
| 126 | SetRpcPort(ctx) |
nothing calls this directly
no test coverage detected