aboutsummaryrefslogtreecommitdiffstats
path: root/core/state_transition.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-02-27 01:39:05 +0800
committerobscuren <geffobscura@gmail.com>2015-02-27 03:08:35 +0800
commite235b57234a68a8a39cfe7691a1825d8c6bb3443 (patch)
treea9531d9e14c15abd72625a98a21a9b988dc32319 /core/state_transition.go
parenta1c830cd3c53bce7748d97e3f99fe6a90d526adb (diff)
downloaddexon-e235b57234a68a8a39cfe7691a1825d8c6bb3443.tar.gz
dexon-e235b57234a68a8a39cfe7691a1825d8c6bb3443.tar.zst
dexon-e235b57234a68a8a39cfe7691a1825d8c6bb3443.zip
Fixed consensus issue for refunding
* Refund should _always_ go to the origin
Diffstat (limited to 'core/state_transition.go')
-rw-r--r--core/state_transition.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/state_transition.go b/core/state_transition.go
index 36ffa23d9..a065c4f6b 100644
--- a/core/state_transition.go
+++ b/core/state_transition.go
@@ -126,7 +126,7 @@ func (self *StateTransition) BuyGas() error {
self.AddGas(self.msg.Gas())
self.initialGas.Set(self.msg.Gas())
- sender.SubAmount(MessageGasValue(self.msg))
+ sender.SubBalance(MessageGasValue(self.msg))
return nil
}
@@ -251,13 +251,16 @@ func (self *StateTransition) RefundGas() {
coinbase, sender := self.Coinbase(), self.From()
// Return remaining gas
remaining := new(big.Int).Mul(self.gas, self.msg.GasPrice())
- sender.AddAmount(remaining)
+ fmt.Println("REFUND:", remaining)
+ sender.AddBalance(remaining)
uhalf := new(big.Int).Div(self.GasUsed(), ethutil.Big2)
for addr, ref := range self.state.Refunds() {
refund := ethutil.BigMin(uhalf, ref)
self.gas.Add(self.gas, refund)
- self.state.AddBalance([]byte(addr), refund.Mul(refund, self.msg.GasPrice()))
+ addToIt := refund.Mul(refund, self.msg.GasPrice())
+ fmt.Println("ADD TO IT", addToIt)
+ self.state.AddBalance([]byte(addr), addToIt)
}
coinbase.RefundGas(self.gas, self.msg.GasPrice())