Fixed consensus issue for refunding

* Refund should _always_ go to the origin
This commit is contained in:
obscuren
2015-02-26 18:39:05 +01:00
parent a1c830cd3c
commit e235b57234
6 changed files with 31 additions and 18 deletions

View File

@ -664,6 +664,7 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
}
addr = ref.Address()
fmt.Printf("CREATE %X\n", addr)
stack.Push(ethutil.BigD(addr))
}
@ -727,7 +728,7 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
self.Printf(" => (%x) %v", receiver.Address()[:4], balance)
receiver.AddAmount(balance)
receiver.AddBalance(balance)
statedb.Delete(context.Address())
fallthrough
@ -828,7 +829,7 @@ func (self *Vm) calculateGasAndSize(context *Context, caller ContextRef, op OpCo
// 0 => non 0
mult = ethutil.Big3
} else if len(val) > 0 && len(y.Bytes()) == 0 {
statedb.Refund(caller.Address(), GasSStoreRefund)
statedb.Refund(self.env.Origin(), GasSStoreRefund)
mult = ethutil.Big0
} else {