Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nknc getnonce command invalid params #936

Merged
merged 1 commit into from
May 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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