diff options
author | obscuren <geffobscura@gmail.com> | 2015-06-20 22:28:11 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-06-21 23:09:19 +0800 |
commit | 07c3de3f75a579cf573fae7bf7c0ec11427dda9f (patch) | |
tree | 2007b80da898cb96c9a00f1565bebb64271d712b /core/state | |
parent | 3deded28a50398b8ce108c72f27ea861c1bce178 (diff) | |
download | go-tangerine-07c3de3f75a579cf573fae7bf7c0ec11427dda9f.tar go-tangerine-07c3de3f75a579cf573fae7bf7c0ec11427dda9f.tar.gz go-tangerine-07c3de3f75a579cf573fae7bf7c0ec11427dda9f.tar.bz2 go-tangerine-07c3de3f75a579cf573fae7bf7c0ec11427dda9f.tar.lz go-tangerine-07c3de3f75a579cf573fae7bf7c0ec11427dda9f.tar.xz go-tangerine-07c3de3f75a579cf573fae7bf7c0ec11427dda9f.tar.zst go-tangerine-07c3de3f75a579cf573fae7bf7c0ec11427dda9f.zip |
core, miner, xeth: renamed gas methods
* BuyGas => SubGas
* RefundGas => AddGas
* SetGasPool => SetGasLimit
Diffstat (limited to 'core/state')
-rw-r--r-- | core/state/state_object.go | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/core/state/state_object.go b/core/state/state_object.go index 2e4fe3269..a31c182d2 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -104,7 +104,6 @@ func NewStateObjectFromBytes(address common.Address, data []byte, db common.Data } object := &StateObject{address: address, db: db} - //object.RlpDecode(data) object.nonce = extobject.Nonce object.balance = extobject.Balance object.codeHash = extobject.CodeHash @@ -215,20 +214,8 @@ func (c *StateObject) St() Storage { // Return the gas back to the origin. Used by the Virtual machine or Closures func (c *StateObject) ReturnGas(gas, price *big.Int) {} -func (c *StateObject) ConvertGas(gas, price *big.Int) error { - total := new(big.Int).Mul(gas, price) - if total.Cmp(c.balance) > 0 { - return fmt.Errorf("insufficient amount: %v, %v", c.balance, total) - } - - c.SubBalance(total) - - c.dirty = true - - return nil -} -func (self *StateObject) SetGasPool(gasLimit *big.Int) { +func (self *StateObject) SetGasLimit(gasLimit *big.Int) { self.gasPool = new(big.Int).Set(gasLimit) if glog.V(logger.Core) { @@ -236,7 +223,7 @@ func (self *StateObject) SetGasPool(gasLimit *big.Int) { } } -func (self *StateObject) BuyGas(gas, price *big.Int) error { +func (self *StateObject) SubGas(gas, price *big.Int) error { if self.gasPool.Cmp(gas) < 0 { return GasLimitError(self.gasPool, gas) } @@ -251,7 +238,7 @@ func (self *StateObject) BuyGas(gas, price *big.Int) error { return nil } -func (self *StateObject) RefundGas(gas, price *big.Int) { +func (self *StateObject) AddGas(gas, price *big.Int) { self.gasPool.Add(self.gasPool, gas) } |