From 16fc5d0b52aa4b1ad26bc9a9ec1a032d8004760d Mon Sep 17 00:00:00 2001 From: Luke Williams Date: Thu, 16 May 2019 17:41:52 +0200 Subject: [PATCH] common/types: add StringToAddress (used in mainnet genesis definition) --- common/types.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/types.go b/common/types.go index c693518c1a..faa602fc77 100644 --- a/common/types.go +++ b/common/types.go @@ -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. 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 // Ethereum address or not. func IsHexAddress(s string) bool {