forked from TrueCloudLab/neoneo-go
cli/vm: use ParseInt to properly (and easily) check for int32
This commit is contained in:
parent
735db08f84
commit
4d2afa2624
1 changed files with 1 additions and 5 deletions
|
@ -10,7 +10,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"math/big"
|
||||
"os"
|
||||
"strconv"
|
||||
|
@ -1026,13 +1025,10 @@ func getDumpArgs(c *cli.Context) (int32, []byte, error) {
|
|||
)
|
||||
h, err := flags.ParseAddress(hashOrID)
|
||||
if err != nil {
|
||||
i, err := strconv.Atoi(hashOrID)
|
||||
i, err := strconv.ParseInt(hashOrID, 10, 32)
|
||||
if err != nil {
|
||||
return 0, nil, fmt.Errorf("failed to parse contract hash, address or ID: %w", err)
|
||||
}
|
||||
if i > math.MaxInt32 {
|
||||
return 0, nil, fmt.Errorf("contract ID exceeds max int32 value")
|
||||
}
|
||||
id = int32(i)
|
||||
} else {
|
||||
cs, err := ic.GetContract(h)
|
||||
|
|
Loading…
Reference in a new issue