aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-12-19 05:38:51 +0800
committerobscuren <geffobscura@gmail.com>2014-12-19 05:38:51 +0800
commit332568379454dce6b1fb3c3e023a53d0c52cded0 (patch)
treecf7ba0c6cdc922d102ff2ffd08c6dc20e1af06ab /core
parentf7287c626e31e980d5b164935ae913db3855eb81 (diff)
downloaddexon-332568379454dce6b1fb3c3e023a53d0c52cded0.tar.gz
dexon-332568379454dce6b1fb3c3e023a53d0c52cded0.tar.zst
dexon-332568379454dce6b1fb3c3e023a53d0c52cded0.zip
Fixed refund model
Diffstat (limited to 'core')
-rw-r--r--core/state_transition.go10
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()