aboutsummaryrefslogtreecommitdiffstats
path: root/core/state/state_object.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/state/state_object.go')
-rw-r--r--core/state/state_object.go37
1 files changed, 1 insertions, 36 deletions
diff --git a/core/state/state_object.go b/core/state/state_object.go
index 40af9ed9c..c06e3d227 100644
--- a/core/state/state_object.go
+++ b/core/state/state_object.go
@@ -75,11 +75,6 @@ type StateObject struct {
// Cached storage (flushed when updated)
storage Storage
- // Total gas pool is the total amount of gas currently
- // left if this object is the coinbase. Gas is directly
- // purchased of the coinbase.
- gasPool *big.Int
-
// Mark for deletion
// When an object is marked for deletion it will be delete from the trie
// during the "update" phase of the state transition
@@ -89,10 +84,9 @@ type StateObject struct {
}
func NewStateObject(address common.Address, db ethdb.Database) *StateObject {
- object := &StateObject{db: db, address: address, balance: new(big.Int), gasPool: new(big.Int), dirty: true}
+ object := &StateObject{db: db, address: address, balance: new(big.Int), dirty: true}
object.trie, _ = trie.NewSecure(common.Hash{}, db)
object.storage = make(Storage)
- object.gasPool = new(big.Int)
return object
}
@@ -121,7 +115,6 @@ func NewStateObjectFromBytes(address common.Address, data []byte, db ethdb.Datab
object.codeHash = extobject.CodeHash
object.trie = trie
object.storage = make(map[string]common.Hash)
- object.gasPool = new(big.Int)
object.code, _ = db.Get(extobject.CodeHash)
return object
}
@@ -209,36 +202,9 @@ func (c *StateObject) St() Storage {
return c.storage
}
-//
-// Gas setters and getters
-//
-
// Return the gas back to the origin. Used by the Virtual machine or Closures
func (c *StateObject) ReturnGas(gas, price *big.Int) {}
-func (self *StateObject) SetGasLimit(gasLimit *big.Int) {
- self.gasPool = new(big.Int).Set(gasLimit)
- self.dirty = true
-
- if glog.V(logger.Core) {
- glog.Infof("%x: gas (+ %v)", self.Address(), self.gasPool)
- }
-}
-
-func (self *StateObject) SubGas(gas, price *big.Int) error {
- if self.gasPool.Cmp(gas) < 0 {
- return GasLimitError(self.gasPool, gas)
- }
- self.gasPool.Sub(self.gasPool, gas)
- self.dirty = true
- return nil
-}
-
-func (self *StateObject) AddGas(gas, price *big.Int) {
- self.gasPool.Add(self.gasPool, gas)
- self.dirty = true
-}
-
func (self *StateObject) Copy() *StateObject {
stateObject := NewStateObject(self.Address(), self.db)
stateObject.balance.Set(self.balance)
@@ -248,7 +214,6 @@ func (self *StateObject) Copy() *StateObject {
stateObject.code = common.CopyBytes(self.code)
stateObject.initCode = common.CopyBytes(self.initCode)
stateObject.storage = self.storage.Copy()
- stateObject.gasPool.Set(self.gasPool)
stateObject.remove = self.remove
stateObject.dirty = self.dirty
stateObject.deleted = self.deleted