diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-17 06:10:26 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-17 06:10:26 +0800 |
commit | 843db4978e876674ca111706880a58c84202880d (patch) | |
tree | 6d565f14ae8ed2524c73e478e301891c4d86436e /common/types.go | |
parent | 4e181c5764b78193705f91d3220710bb63b8962f (diff) | |
download | dexon-843db4978e876674ca111706880a58c84202880d.tar dexon-843db4978e876674ca111706880a58c84202880d.tar.gz dexon-843db4978e876674ca111706880a58c84202880d.tar.bz2 dexon-843db4978e876674ca111706880a58c84202880d.tar.lz dexon-843db4978e876674ca111706880a58c84202880d.tar.xz dexon-843db4978e876674ca111706880a58c84202880d.tar.zst dexon-843db4978e876674ca111706880a58c84202880d.zip |
updated blockpool
Diffstat (limited to 'common/types.go')
-rw-r--r-- | common/types.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/common/types.go b/common/types.go index 267077f4f..9729378e8 100644 --- a/common/types.go +++ b/common/types.go @@ -24,6 +24,7 @@ func BytesToHash(b []byte) Hash { } 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)) } // Don't use the default 'String' method in case we want to overwrite @@ -62,11 +63,13 @@ func BytesToAddress(b []byte) Address { } 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)) } // Get the string representation of the underlying address func (a Address) Str() string { return string(a[:]) } func (a Address) Bytes() []byte { return a[:] } func (a Address) Big() *big.Int { return Bytes2Big(a[:]) } +func (a Address) Hash() Hash { return BytesToHash(a[:]) } // Sets the address to the value of b. If b is larger than len(a) it will panic func (a *Address) SetBytes(b []byte) { |