diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-24 22:15:17 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-24 22:15:17 +0800 |
commit | 23bccbbc587aa22057eb7ae29c5b87d44b7cac7d (patch) | |
tree | 70e03dcff049ebbca32dc34c53881cf6b9e20a7c /core/execution.go | |
parent | bbe795455a13c57dbba64c1082b618e791af46ce (diff) | |
download | go-tangerine-23bccbbc587aa22057eb7ae29c5b87d44b7cac7d.tar.gz go-tangerine-23bccbbc587aa22057eb7ae29c5b87d44b7cac7d.tar.zst go-tangerine-23bccbbc587aa22057eb7ae29c5b87d44b7cac7d.zip |
Modified according to poc 9 changes
* Refund of value
Diffstat (limited to 'core/execution.go')
-rw-r--r-- | core/execution.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/core/execution.go b/core/execution.go index 893b79dc7..72eb22bd5 100644 --- a/core/execution.go +++ b/core/execution.go @@ -39,20 +39,22 @@ func (self *Execution) exec(contextAddr *common.Address, code []byte, caller vm. return nil, vm.DepthError{} } - snapshot := env.State().Copy() + vsnapshot := env.State().Copy() if self.address == nil { // Generate a new address nonce := env.State().GetNonce(caller.Address()) addr := crypto.CreateAddress(caller.Address(), nonce) - self.address = &addr env.State().SetNonce(caller.Address(), nonce+1) + self.address = &addr } + snapshot := env.State().Copy() from, to := env.State().GetStateObject(caller.Address()), env.State().GetOrNewStateObject(*self.address) err = env.Transfer(from, to, self.value) if err != nil { - env.State().Set(snapshot) - //caller.ReturnGas(self.Gas, self.price) + env.State().Set(vsnapshot) + + caller.ReturnGas(self.Gas, self.price) return nil, ValueTransferErr("insufficient funds to transfer value. Req %v, has %v", self.value, from.Balance()) } |