core/state, core/vm: cleanup refunds

This commit is contained in:
obscuren
2015-06-17 10:20:33 +02:00
parent dfd18d245a
commit 5721fcf668
3 changed files with 13 additions and 21 deletions

View File

@ -241,11 +241,9 @@ func (self *StateTransition) refundGas() {
sender.AddBalance(remaining)
uhalf := new(big.Int).Div(self.gasUsed(), common.Big2)
for addr, ref := range self.state.Refunds() {
refund := common.BigMin(uhalf, ref)
self.gas.Add(self.gas, refund)
self.state.AddBalance(common.StringToAddress(addr), refund.Mul(refund, self.msg.GasPrice()))
}
refund := common.BigMin(uhalf, self.state.Refunds())
self.gas.Add(self.gas, refund)
self.state.AddBalance(sender.Address(), refund.Mul(refund, self.msg.GasPrice()))
coinbase.RefundGas(self.gas, self.msg.GasPrice())
}