@@ -104,7 +104,6 @@ func NewStateObjectFromBytes(address common.Address, data []byte, db common.Data
104
104
}
105
105
106
106
object := & StateObject {address : address , db : db }
107
- //object.RlpDecode(data)
108
107
object .nonce = extobject .Nonce
109
108
object .balance = extobject .Balance
110
109
object .codeHash = extobject .CodeHash
@@ -215,28 +214,16 @@ func (c *StateObject) St() Storage {
215
214
216
215
// Return the gas back to the origin. Used by the Virtual machine or Closures
217
216
func (c * StateObject ) ReturnGas (gas , price * big.Int ) {}
218
- func (c * StateObject ) ConvertGas (gas , price * big.Int ) error {
219
- total := new (big.Int ).Mul (gas , price )
220
- if total .Cmp (c .balance ) > 0 {
221
- return fmt .Errorf ("insufficient amount: %v, %v" , c .balance , total )
222
- }
223
-
224
- c .SubBalance (total )
225
-
226
- c .dirty = true
227
-
228
- return nil
229
- }
230
217
231
- func (self * StateObject ) SetGasPool (gasLimit * big.Int ) {
218
+ func (self * StateObject ) SetGasLimit (gasLimit * big.Int ) {
232
219
self .gasPool = new (big.Int ).Set (gasLimit )
233
220
234
221
if glog .V (logger .Core ) {
235
222
glog .Infof ("%x: gas (+ %v)" , self .Address (), self .gasPool )
236
223
}
237
224
}
238
225
239
- func (self * StateObject ) BuyGas (gas , price * big.Int ) error {
226
+ func (self * StateObject ) SubGas (gas , price * big.Int ) error {
240
227
if self .gasPool .Cmp (gas ) < 0 {
241
228
return GasLimitError (self .gasPool , gas )
242
229
}
@@ -251,7 +238,7 @@ func (self *StateObject) BuyGas(gas, price *big.Int) error {
251
238
return nil
252
239
}
253
240
254
- func (self * StateObject ) RefundGas (gas , price * big.Int ) {
241
+ func (self * StateObject ) AddGas (gas , price * big.Int ) {
255
242
self .gasPool .Add (self .gasPool , gas )
256
243
}
257
244
0 commit comments