diff --git a/common/bytes.go b/common/bytes.go index d1f5c6c995..ecbc64304a 100644 --- a/common/bytes.go +++ b/common/bytes.go @@ -27,7 +27,7 @@ import ( // FromHex returns the bytes represented by the hexadecimal string s. // s may be prefixed with "0x". func FromHex(s string) []byte { - if has0xPrefix(s) { + if hexutil.Has0xPrefix(s) { s = s[2:] } if len(s)%2 == 1 { @@ -47,11 +47,6 @@ func CopyBytes(b []byte) (copiedBytes []byte) { return } -// has0xPrefix validates str begins with '0x' or '0X'. -func has0xPrefix(str string) bool { - return len(str) >= 2 && str[0] == '0' && (str[1] == 'x' || str[1] == 'X') -} - // isHexCharacter returns bool of c being a valid hexadecimal. func isHexCharacter(c byte) bool { return ('0' <= c && c <= '9') || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F')