aboutsummaryrefslogtreecommitdiffstats
path: root/state/state_object.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-02-20 05:33:22 +0800
committerobscuren <geffobscura@gmail.com>2015-02-20 05:33:22 +0800
commitfa4cbad315609e41d88c59ecbce7c6c6169fc57a (patch)
tree5af4a3cfd497e682e41898059571b75f6f8e4cf9 /state/state_object.go
parentc14071df9da4ab3f5b372293e87184af9b91c09e (diff)
downloaddexon-fa4cbad315609e41d88c59ecbce7c6c6169fc57a.tar.gz
dexon-fa4cbad315609e41d88c59ecbce7c6c6169fc57a.tar.zst
dexon-fa4cbad315609e41d88c59ecbce7c6c6169fc57a.zip
Optimisations and fixed a couple of DDOS issues in the miner
Diffstat (limited to 'state/state_object.go')
-rw-r--r--state/state_object.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/state/state_object.go b/state/state_object.go
index eaa91c713..d50c9fd7a 100644
--- a/state/state_object.go
+++ b/state/state_object.go
@@ -53,6 +53,7 @@ type StateObject struct {
// When an object is marked for deletion it will be delete from the trie
// during the "update" phase of the state transition
remove bool
+ dirty bool
}
func (self *StateObject) Reset() {
@@ -211,6 +212,8 @@ func (self *StateObject) BuyGas(gas, price *big.Int) error {
return GasLimitError(self.gasPool, gas)
}
+ self.gasPool.Sub(self.gasPool, gas)
+
rGas := new(big.Int).Set(gas)
rGas.Mul(rGas, price)
@@ -241,6 +244,7 @@ func (self *StateObject) Copy() *StateObject {
stateObject.storage = self.storage.Copy()
stateObject.gasPool.Set(self.gasPool)
stateObject.remove = self.remove
+ stateObject.dirty = self.dirty
return stateObject
}