From 10488778b4302426e03addc83c53a9c053c93658 Mon Sep 17 00:00:00 2001 From: Jin Date: Wed, 30 Aug 2023 14:20:47 +0800 Subject: [PATCH] BUG:Incorrect conversion between integer types --- core/protocol/hashornumber.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/protocol/hashornumber.go b/core/protocol/hashornumber.go index 06520e4b..91968faf 100644 --- a/core/protocol/hashornumber.go +++ b/core/protocol/hashornumber.go @@ -8,7 +8,7 @@ import ( type HashOrNumber struct { Hash *hash.Hash - Number uint64 + Number uint32 } func (hn *HashOrNumber) IsHash() bool { @@ -26,9 +26,9 @@ func NewHashOrNumber(data string) (*HashOrNumber, error) { if len(data) <= 0 { return nil, fmt.Errorf("HashOrNumber:no input data") } - num, err := strconv.Atoi(data) + num, err := strconv.ParseUint(data, 10, 32) if err == nil { - return &HashOrNumber{Number: uint64(num)}, nil + return &HashOrNumber{Number: uint32(num)}, nil } h, err := hash.NewHashFromStr(data) if err != nil {