mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
Merge c64a460ba0 into 6cdfb9a3eb
This commit is contained in:
commit
a48bf04e37
1 changed files with 8 additions and 2 deletions
|
|
@ -143,8 +143,14 @@ func BytesToAddress(b []byte) Address {
|
||||||
a.SetBytes(b)
|
a.SetBytes(b)
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// StringToAddress converts an arbitrary string into an Address.
|
||||||
func StringToAddress(s string) Address { return BytesToAddress([]byte(s)) }
|
func StringToAddress(s string) Address { return BytesToAddress([]byte(s)) }
|
||||||
|
|
||||||
|
// BigToAddress converts an arbitary *big.Int into an Address.
|
||||||
func BigToAddress(b *big.Int) Address { return BytesToAddress(b.Bytes()) }
|
func BigToAddress(b *big.Int) Address { return BytesToAddress(b.Bytes()) }
|
||||||
|
|
||||||
|
// HexToAddress converts a string containing an address into an Address.
|
||||||
func HexToAddress(s string) Address { return BytesToAddress(FromHex(s)) }
|
func HexToAddress(s string) Address { return BytesToAddress(FromHex(s)) }
|
||||||
|
|
||||||
// IsHexAddress verifies whether a string can represent a valid hex-encoded
|
// IsHexAddress verifies whether a string can represent a valid hex-encoded
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue