mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
common/types: add StringToAddress (used in mainnet genesis definition)
This commit is contained in:
parent
7defef6387
commit
16fc5d0b52
1 changed files with 4 additions and 0 deletions
|
|
@ -175,6 +175,10 @@ func BigToAddress(b *big.Int) Address { return BytesToAddress(b.Bytes()) }
|
||||||
// If s is larger than len(h), s will be cropped from the left.
|
// If s is larger than len(h), s will be cropped from the left.
|
||||||
func HexToAddress(s string) Address { return BytesToAddress(FromHex(s)) }
|
func HexToAddress(s string) Address { return BytesToAddress(FromHex(s)) }
|
||||||
|
|
||||||
|
// StringToAddress returns Address with byte values of s.
|
||||||
|
// If s is larger than len(h), s will be cropped from the left.
|
||||||
|
func StringToAddress(s string) Address { return BytesToAddress([]byte(s)) }
|
||||||
|
|
||||||
// IsHexAddress verifies whether a string can represent a valid hex-encoded
|
// IsHexAddress verifies whether a string can represent a valid hex-encoded
|
||||||
// Ethereum address or not.
|
// Ethereum address or not.
|
||||||
func IsHexAddress(s string) bool {
|
func IsHexAddress(s string) bool {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue