aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-04-02 21:53:04 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-04-02 21:53:04 +0800
commitaa71e27a3b0f42b980082c52232c68fb50a45052 (patch)
tree544c33d6af9d5657d8a422d218a8b9883f059765 /common
parent39085905783829161738207271aa35386f6ebc72 (diff)
downloadgo-tangerine-aa71e27a3b0f42b980082c52232c68fb50a45052.tar.gz
go-tangerine-aa71e27a3b0f42b980082c52232c68fb50a45052.tar.zst
go-tangerine-aa71e27a3b0f42b980082c52232c68fb50a45052.zip
Detect non-valid strings for blockheight
Diffstat (limited to 'common')
-rw-r--r--common/bytes.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/common/bytes.go b/common/bytes.go
index 2d885ac74..5bdacd810 100644
--- a/common/bytes.go
+++ b/common/bytes.go
@@ -127,6 +127,11 @@ func CopyBytes(b []byte) (copiedBytes []byte) {
return
}
+func HasHexPrefix(str string) bool {
+ l := len(str)
+ return l >= 2 && str[0:2] == "0x"
+}
+
func IsHex(str string) bool {
l := len(str)
return l >= 4 && l%2 == 0 && str[0:2] == "0x"