aboutsummaryrefslogtreecommitdiffstats
path: root/core/state_transition.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/state_transition.go')
-rw-r--r--core/state_transition.go23
1 files changed, 5 insertions, 18 deletions
diff --git a/core/state_transition.go b/core/state_transition.go
index fedea8021..915dd466b 100644
--- a/core/state_transition.go
+++ b/core/state_transition.go
@@ -151,7 +151,7 @@ func (self *StateTransition) BuyGas() error {
}
coinbase := self.Coinbase()
- err = coinbase.BuyGas(self.msg.Gas(), self.msg.GasPrice())
+ err = coinbase.SubGas(self.msg.Gas(), self.msg.GasPrice())
if err != nil {
return err
}
@@ -241,26 +241,13 @@ 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())
+ coinbase.AddGas(self.gas, self.msg.GasPrice())
}
func (self *StateTransition) gasUsed() *big.Int {
return new(big.Int).Sub(self.initialGas, self.gas)
}
-
-// Converts an message in to a state object
-func makeContract(msg Message, state *state.StateDB) *state.StateObject {
- faddr, _ := msg.From()
- addr := crypto.CreateAddress(faddr, msg.Nonce())
-
- contract := state.GetOrNewStateObject(addr)
- contract.SetInitCode(msg.Data())
-
- return contract
-}