diff options
author | obscuren <geffobscura@gmail.com> | 2014-12-19 05:38:51 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-12-19 05:38:51 +0800 |
commit | 332568379454dce6b1fb3c3e023a53d0c52cded0 (patch) | |
tree | cf7ba0c6cdc922d102ff2ffd08c6dc20e1af06ab /core/state_transition.go | |
parent | f7287c626e31e980d5b164935ae913db3855eb81 (diff) | |
download | dexon-332568379454dce6b1fb3c3e023a53d0c52cded0.tar dexon-332568379454dce6b1fb3c3e023a53d0c52cded0.tar.gz dexon-332568379454dce6b1fb3c3e023a53d0c52cded0.tar.bz2 dexon-332568379454dce6b1fb3c3e023a53d0c52cded0.tar.lz dexon-332568379454dce6b1fb3c3e023a53d0c52cded0.tar.xz dexon-332568379454dce6b1fb3c3e023a53d0c52cded0.tar.zst dexon-332568379454dce6b1fb3c3e023a53d0c52cded0.zip |
Fixed refund model
Diffstat (limited to 'core/state_transition.go')
-rw-r--r-- | core/state_transition.go | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/core/state_transition.go b/core/state_transition.go index 34d8cca74..9e81ddf28 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -213,12 +213,10 @@ func MakeContract(msg Message, state *state.StateDB) *state.StateObject { func (self *StateTransition) RefundGas() { coinbaseSub := new(big.Int).Set(self.gas) uhalf := new(big.Int).Div(self.GasUsed(), ethutil.Big2) - for addr, refs := range self.state.Refunds() { - for _, ref := range refs { - coinbaseSub.Add(self.gas, ref) - refund := ethutil.BigMin(uhalf, ref) - self.state.AddBalance([]byte(addr), refund.Mul(refund, self.msg.GasPrice())) - } + for addr, ref := range self.state.Refunds() { + refund := ethutil.BigMin(uhalf, ref) + coinbaseSub.Add(self.gas, refund) + self.state.AddBalance([]byte(addr), refund.Mul(refund, self.msg.GasPrice())) } coinbase, sender := self.Coinbase(), self.From() |