Skip to content

Commit

Permalink
Fix nknc getnonce command invalid params
Browse files Browse the repository at this point in the history
Signed-off-by: Yilun <zyl.skysniper@gmail.com>
  • Loading branch information
yilunzhang committed May 8, 2023
1 parent 551158c commit 16df46d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cmd/nknc/commands/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ var (
state bool
nodeversion bool
balance string
nonceAddr string
idstr string
)

Expand All @@ -68,8 +69,8 @@ func init() {
infoCmd.Flags().BoolVar(&ring, "ring", false, "chord ring information of current node")
infoCmd.Flags().BoolVarP(&state, "state", "s", false, "current node state")
infoCmd.Flags().BoolVarP(&nodeversion, "nodeversion", "v", false, "version of connected remote node")
infoCmd.Flags().StringVar(&balance, "balance", "", "balance of a address")
infoCmd.Flags().Uint64Var(&nonce, "nonce", 0, "nonce of a address")
infoCmd.Flags().StringVar(&balance, "balance", "", "balance of an address")
infoCmd.Flags().StringVar(&nonceAddr, "nonce", "", "nonce of an address")
infoCmd.Flags().StringVar(&idstr, "id", "", "id from publickey")

}
Expand Down Expand Up @@ -220,8 +221,8 @@ func infoAction() (err error) {
output = append(output, resp)
}

if nonce > 0 {
resp, err := client.Call(Address(), "getNoncebyaddr", 0, map[string]interface{}{"address": fmt.Sprintf("%d", nonce)})
if nonceAddr != "" {
resp, err := client.Call(Address(), "getnoncebyaddr", 0, map[string]interface{}{"address": nonceAddr})
if err != nil {
fmt.Fprintln(os.Stderr, err)
return err
Expand Down

0 comments on commit 16df46d

Please sign in to comment.