Merge pull request #2011 from karalabe/fix-hex-address

common: fix #2008, wrong hex prefix check
This commit is contained in:
Jeffrey Wilcke 2015-11-27 19:16:31 +01:00
commit a0d203a874
1 changed files with 2 additions and 2 deletions

View File

@ -95,10 +95,10 @@ func HexToAddress(s string) Address { return BytesToAddress(FromHex(s)) }
// IsHexAddress verifies whether a string can represent a valid hex-encoded
// Ethereum address or not.
func IsHexAddress(s string) bool {
if len(s) == 2+2*AddressLength && IsHex(s[2:]) {
if len(s) == 2+2*AddressLength && IsHex(s) {
return true
}
if len(s) == 2*AddressLength && IsHex(s) {
if len(s) == 2*AddressLength && IsHex("0x"+s) {
return true
}
return false