@@ -45,15 +45,16 @@ func (self *StateDB) Logs() Logs {
4545 return self .logs
4646}
4747
48- func (self * StateDB ) Refund (addr []byte , gas * big.Int ) {
49- if self .refund [string (addr )] == nil {
50- self .refund [string (addr )] = new (big.Int )
48+ func (self * StateDB ) Refund (address common.Address , gas * big.Int ) {
49+ addr := address .Str ()
50+ if self .refund [addr ] == nil {
51+ self .refund [addr ] = new (big.Int )
5152 }
52- self .refund [string ( addr ) ].Add (self .refund [string ( addr ) ], gas )
53+ self .refund [addr ].Add (self .refund [addr ], gas )
5354}
5455
5556// Retrieve the balance from the given address or 0 if object not found
56- func (self * StateDB ) GetBalance (addr [] byte ) * big.Int {
57+ func (self * StateDB ) GetBalance (addr common. Address ) * big.Int {
5758 stateObject := self .GetStateObject (addr )
5859 if stateObject != nil {
5960 return stateObject .balance
@@ -62,14 +63,14 @@ func (self *StateDB) GetBalance(addr []byte) *big.Int {
6263 return common .Big0
6364}
6465
65- func (self * StateDB ) AddBalance (addr [] byte , amount * big.Int ) {
66+ func (self * StateDB ) AddBalance (addr common. Address , amount * big.Int ) {
6667 stateObject := self .GetStateObject (addr )
6768 if stateObject != nil {
6869 stateObject .AddBalance (amount )
6970 }
7071}
7172
72- func (self * StateDB ) GetNonce (addr [] byte ) uint64 {
73+ func (self * StateDB ) GetNonce (addr common. Address ) uint64 {
7374 stateObject := self .GetStateObject (addr )
7475 if stateObject != nil {
7576 return stateObject .nonce
@@ -78,7 +79,7 @@ func (self *StateDB) GetNonce(addr []byte) uint64 {
7879 return 0
7980}
8081
81- func (self * StateDB ) GetCode (addr [] byte ) []byte {
82+ func (self * StateDB ) GetCode (addr common. Address ) []byte {
8283 stateObject := self .GetStateObject (addr )
8384 if stateObject != nil {
8485 return stateObject .code
@@ -87,7 +88,7 @@ func (self *StateDB) GetCode(addr []byte) []byte {
8788 return nil
8889}
8990
90- func (self * StateDB ) GetState (a , b [] byte ) []byte {
91+ func (self * StateDB ) GetState (a common. Adress , b common. Hash ) []byte {
9192 stateObject := self .GetStateObject (a )
9293 if stateObject != nil {
9394 return stateObject .GetState (b ).Bytes ()
@@ -96,28 +97,28 @@ func (self *StateDB) GetState(a, b []byte) []byte {
9697 return nil
9798}
9899
99- func (self * StateDB ) SetNonce (addr [] byte , nonce uint64 ) {
100+ func (self * StateDB ) SetNonce (addr common. Address , nonce uint64 ) {
100101 stateObject := self .GetStateObject (addr )
101102 if stateObject != nil {
102103 stateObject .SetNonce (nonce )
103104 }
104105}
105106
106- func (self * StateDB ) SetCode (addr , code []byte ) {
107+ func (self * StateDB ) SetCode (addr common. Address , code []byte ) {
107108 stateObject := self .GetStateObject (addr )
108109 if stateObject != nil {
109110 stateObject .SetCode (code )
110111 }
111112}
112113
113- func (self * StateDB ) SetState (addr , key [] byte , value interface {}) {
114+ func (self * StateDB ) SetState (addr common. Address , key common. Hash , value interface {}) {
114115 stateObject := self .GetStateObject (addr )
115116 if stateObject != nil {
116117 stateObject .SetState (key , common .NewValue (value ))
117118 }
118119}
119120
120- func (self * StateDB ) Delete (addr [] byte ) bool {
121+ func (self * StateDB ) Delete (addr common. Address ) bool {
121122 stateObject := self .GetStateObject (addr )
122123 if stateObject != nil {
123124 stateObject .MarkForDeletion ()
@@ -129,7 +130,7 @@ func (self *StateDB) Delete(addr []byte) bool {
129130 return false
130131}
131132
132- func (self * StateDB ) IsDeleted (addr [] byte ) bool {
133+ func (self * StateDB ) IsDeleted (addr common. Address ) bool {
133134 stateObject := self .GetStateObject (addr )
134135 if stateObject != nil {
135136 return stateObject .remove
@@ -143,27 +144,27 @@ func (self *StateDB) IsDeleted(addr []byte) bool {
143144
144145// Update the given state object and apply it to state trie
145146func (self * StateDB ) UpdateStateObject (stateObject * StateObject ) {
146- addr := stateObject .Address ()
147+ // addr := stateObject.Address()
147148
148149 if len (stateObject .CodeHash ()) > 0 {
149150 self .db .Put (stateObject .CodeHash (), stateObject .code )
150151 }
151152
152- self .trie .Update (addr , stateObject .RlpEncode ())
153+ self .trie .Update (stateObject . Address () , stateObject .RlpEncode ())
153154}
154155
155156// Delete the given state object and delete it from the state trie
156157func (self * StateDB ) DeleteStateObject (stateObject * StateObject ) {
157158 self .trie .Delete (stateObject .Address ())
158159
159- delete (self .stateObjects , string ( stateObject .Address ()))
160+ delete (self .stateObjects , stateObject .Address (). Str ( ))
160161}
161162
162163// Retrieve a state object given my the address. Nil if not found
163- func (self * StateDB ) GetStateObject (addr [] byte ) * StateObject {
164- addr = common .Address (addr )
164+ func (self * StateDB ) GetStateObject (addr common. Address ) * StateObject {
165+ // addr = common.Address(addr)
165166
166- stateObject := self .stateObjects [string ( addr )]
167+ stateObject := self .stateObjects [addr . Str ( )]
167168 if stateObject != nil {
168169 return stateObject
169170 }
@@ -180,11 +181,11 @@ func (self *StateDB) GetStateObject(addr []byte) *StateObject {
180181}
181182
182183func (self * StateDB ) SetStateObject (object * StateObject ) {
183- self .stateObjects [string ( object .address )] = object
184+ self .stateObjects [object .Address (). Str ( )] = object
184185}
185186
186187// Retrieve a state object or create a new state object if nil
187- func (self * StateDB ) GetOrNewStateObject (addr [] byte ) * StateObject {
188+ func (self * StateDB ) GetOrNewStateObject (addr common. Address ) * StateObject {
188189 stateObject := self .GetStateObject (addr )
189190 if stateObject == nil {
190191 stateObject = self .NewStateObject (addr )
@@ -194,8 +195,8 @@ func (self *StateDB) GetOrNewStateObject(addr []byte) *StateObject {
194195}
195196
196197// Create a state object whether it exist in the trie or not
197- func (self * StateDB ) NewStateObject (addr [] byte ) * StateObject {
198- addr = common .Address (addr )
198+ func (self * StateDB ) NewStateObject (addr common. Address ) * StateObject {
199+ // addr = common.Address(addr)
199200
200201 statelogger .Debugf ("(+) %x\n " , addr )
201202
0 commit comments