diff options
author | obscuren <geffobscura@gmail.com> | 2015-02-20 05:33:22 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-02-20 05:33:22 +0800 |
commit | fa4cbad315609e41d88c59ecbce7c6c6169fc57a (patch) | |
tree | 5af4a3cfd497e682e41898059571b75f6f8e4cf9 /state/state_object.go | |
parent | c14071df9da4ab3f5b372293e87184af9b91c09e (diff) | |
download | dexon-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.go | 4 |
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 } |