mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
Update hexutil.go
This commit is contained in:
parent
243407a3aa
commit
da548126ba
1 changed files with 3 additions and 3 deletions
|
|
@ -60,7 +60,7 @@ func Decode(input string) ([]byte, error) {
|
||||||
if len(input) == 0 {
|
if len(input) == 0 {
|
||||||
return nil, ErrEmptyString
|
return nil, ErrEmptyString
|
||||||
}
|
}
|
||||||
if !has0xPrefix(input) {
|
if !Has0xPrefix(input) {
|
||||||
return nil, ErrMissingPrefix
|
return nil, ErrMissingPrefix
|
||||||
}
|
}
|
||||||
b, err := hex.DecodeString(input[2:])
|
b, err := hex.DecodeString(input[2:])
|
||||||
|
|
@ -185,7 +185,7 @@ func EncodeBig(bigint *big.Int) string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func has0xPrefix(input string) bool {
|
func Has0xPrefix(input string) bool {
|
||||||
return len(input) >= 2 && input[0] == '0' && (input[1] == 'x' || input[1] == 'X')
|
return len(input) >= 2 && input[0] == '0' && (input[1] == 'x' || input[1] == 'X')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -193,7 +193,7 @@ func checkNumber(input string) (raw string, err error) {
|
||||||
if len(input) == 0 {
|
if len(input) == 0 {
|
||||||
return "", ErrEmptyString
|
return "", ErrEmptyString
|
||||||
}
|
}
|
||||||
if !has0xPrefix(input) {
|
if !Has0xPrefix(input) {
|
||||||
return "", ErrMissingPrefix
|
return "", ErrMissingPrefix
|
||||||
}
|
}
|
||||||
input = input[2:]
|
input = input[2:]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue