aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorFelix Lange <fjl@users.noreply.github.com>2018-04-10 19:12:07 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-04-10 19:12:07 +0800
commitc7ab3e5544a3293819957281ecb7cfc08b4e9813 (patch)
treed1b8c3b8557dbca84b4d1cb6a13d78fb9fe17b86 /common
parent149f706fdee89877efd6ca6e168a9a20aaf61a0c (diff)
downloadgo-tangerine-c7ab3e5544a3293819957281ecb7cfc08b4e9813.tar
go-tangerine-c7ab3e5544a3293819957281ecb7cfc08b4e9813.tar.gz
go-tangerine-c7ab3e5544a3293819957281ecb7cfc08b4e9813.tar.bz2
go-tangerine-c7ab3e5544a3293819957281ecb7cfc08b4e9813.tar.lz
go-tangerine-c7ab3e5544a3293819957281ecb7cfc08b4e9813.tar.xz
go-tangerine-c7ab3e5544a3293819957281ecb7cfc08b4e9813.tar.zst
go-tangerine-c7ab3e5544a3293819957281ecb7cfc08b4e9813.zip
common: delete StringToAddress, StringToHash (#16436)
* common: delete StringToAddress, StringToHash These functions are confusing because they don't parse hex, but use the bytes of the string. This change removes them, replacing all uses of StringToAddress(s) by BytesToAddress([]byte(s)). * eth/filters: remove incorrect use of common.BytesToAddress
Diffstat (limited to 'common')
-rw-r--r--common/types.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/common/types.go b/common/types.go
index fdc67480c..4ea2d56a6 100644
--- a/common/types.go
+++ b/common/types.go
@@ -45,9 +45,8 @@ func BytesToHash(b []byte) Hash {
h.SetBytes(b)
return h
}
-func StringToHash(s string) Hash { return BytesToHash([]byte(s)) }
-func BigToHash(b *big.Int) Hash { return BytesToHash(b.Bytes()) }
-func HexToHash(s string) Hash { return BytesToHash(FromHex(s)) }
+func BigToHash(b *big.Int) Hash { return BytesToHash(b.Bytes()) }
+func HexToHash(s string) Hash { return BytesToHash(FromHex(s)) }
// Get the string representation of the underlying hash
func (h Hash) Str() string { return string(h[:]) }
@@ -143,9 +142,8 @@ func BytesToAddress(b []byte) Address {
a.SetBytes(b)
return a
}
-func StringToAddress(s string) Address { return BytesToAddress([]byte(s)) }
-func BigToAddress(b *big.Int) Address { return BytesToAddress(b.Bytes()) }
-func HexToAddress(s string) Address { return BytesToAddress(FromHex(s)) }
+func BigToAddress(b *big.Int) Address { return BytesToAddress(b.Bytes()) }
+func HexToAddress(s string) Address { return BytesToAddress(FromHex(s)) }
// IsHexAddress verifies whether a string can represent a valid hex-encoded
// Ethereum address or not.