@@ -2,7 +2,6 @@ package cmd
22
33import (
44 "context"
5- "math"
65 "strings"
76
87 "github.com/cosmos/cosmos-sdk/client/flags"
@@ -43,6 +42,10 @@ func createClientsCmd(ctx *config.Context) *cobra.Command {
4342 flagSrcHeight = "src-height"
4443 flagDstHeight = "dst-height"
4544 )
45+ const (
46+ defaultSrcHeight = 0
47+ defaultDstHeight = 0
48+ )
4649 cmd := & cobra.Command {
4750 Use : "clients [path-name]" ,
4851 Short : "create a clients between two configured chains with a configured path" ,
@@ -63,29 +66,21 @@ func createClientsCmd(ctx *config.Context) *cobra.Command {
6366 return err
6467 }
6568
66- var srcHeight * uint64
67- if h , err := cmd . Flags (). GetUint64 ( flagSrcHeight ); err != nil {
69+ srcHeight , err := cmd . Flags (). GetUint64 ( flagSrcHeight )
70+ if err != nil {
6871 return err
69- } else if h == math .MaxUint64 {
70- srcHeight = nil
71- } else {
72- srcHeight = & h
7372 }
7473
75- var dstHeight * uint64
76- if h , err := cmd . Flags (). GetUint64 ( flagDstHeight ); err != nil {
74+ dstHeight , err := cmd . Flags (). GetUint64 ( flagDstHeight )
75+ if err != nil {
7776 return err
78- } else if h == math .MaxUint64 {
79- dstHeight = nil
80- } else {
81- dstHeight = & h
8277 }
8378
8479 return core .CreateClients (c [src ], c [dst ], srcHeight , dstHeight )
8580 },
8681 }
87- cmd .Flags ().Uint64 (flagSrcHeight , math . MaxUint64 , "src header at this height is submitted to dst chain" )
88- cmd .Flags ().Uint64 (flagDstHeight , math . MaxUint64 , "dst header at this height is submitted to src chain" )
82+ cmd .Flags ().Uint64 (flagSrcHeight , defaultSrcHeight , "src header at this height is submitted to dst chain" )
83+ cmd .Flags ().Uint64 (flagDstHeight , defaultDstHeight , "dst header at this height is submitted to src chain" )
8984 return cmd
9085}
9186
0 commit comments