Skip to content

Commit

Permalink
BUG:Incorrect conversion between integer types
Browse files Browse the repository at this point in the history
  • Loading branch information
lochjin committed Aug 30, 2023
1 parent 0cf0ccd commit 1048877
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/protocol/hashornumber.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

type HashOrNumber struct {
Hash *hash.Hash
Number uint64
Number uint32
}

func (hn *HashOrNumber) IsHash() bool {
Expand All @@ -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 {
Expand Down

0 comments on commit 1048877

Please sign in to comment.