File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package common
22
3- type (
4- Hash [32 ]byte
5- Address [20 ]byte
6- )
3+ type Hash [32 ]byte
74
85var (
96 zeroHash Hash
@@ -27,7 +24,7 @@ func StringToAddress(s string) Address { return BytesToAddress([]byte(s)) }
2724// Don't use the default 'String' method in case we want to overwrite
2825
2926// Get the string representation of the underlying hash
30- func (h * Hash ) Str () string {
27+ func (h Hash ) Str () string {
3128 return string (h [:])
3229}
3330
@@ -53,13 +50,15 @@ func (h *Hash) Set(other Hash) {
5350 }
5451}
5552
53+ type Address [20 ]byte
54+
5655// Get the string representation of the underlying address
5756func (a Address ) Str () string {
5857 return string (a [:])
5958}
6059
6160// Sets the address to the value of b. If b is larger than len(a) it will panic
62- func (a Address ) SetBytes (b []byte ) {
61+ func (a * Address ) SetBytes (b []byte ) {
6362 if len (b ) > len (a ) {
6463 panic ("unable to set bytes. too big" )
6564 }
@@ -71,10 +70,10 @@ func (a Address) SetBytes(b []byte) {
7170}
7271
7372// Set string `s` to a. If s is larger than len(a) it will panic
74- func (a Address ) SetString (s string ) { a .SetBytes ([]byte (s )) }
73+ func (a * Address ) SetString (s string ) { a .SetBytes ([]byte (s )) }
7574
7675// Sets a to other
77- func (a Address ) Set (other Address ) {
76+ func (a * Address ) Set (other Address ) {
7877 for i , v := range other {
7978 a [i ] = v
8079 }
You can’t perform that action at this time.
0 commit comments