mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
feat: add Address.Bytes32() (#572)
This commit is contained in:
parent
f9d396cf57
commit
8f446dd407
1 changed files with 6 additions and 0 deletions
|
|
@ -245,6 +245,12 @@ func (a Address) Cmp(other Address) int {
|
||||||
// Bytes gets the string representation of the underlying address.
|
// Bytes gets the string representation of the underlying address.
|
||||||
func (a Address) Bytes() []byte { return a[:] }
|
func (a Address) Bytes() []byte { return a[:] }
|
||||||
|
|
||||||
|
func (a Address) Bytes32() []byte {
|
||||||
|
ret := make([]byte, 32)
|
||||||
|
copy(ret, a.Bytes())
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
// Big converts an address to a big integer.
|
// Big converts an address to a big integer.
|
||||||
func (a Address) Big() *big.Int { return new(big.Int).SetBytes(a[:]) }
|
func (a Address) Big() *big.Int { return new(big.Int).SetBytes(a[:]) }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue