diff options
author | obscuren <geffobscura@gmail.com> | 2014-07-03 22:07:21 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-07-03 22:07:21 +0800 |
commit | 8baa0f84e70aafa3882ec477d3b3d401d462958b (patch) | |
tree | 954a7a8dc9dac2e8235db5f17dc533ddcfc58974 /ethchain/vm.go | |
parent | 5d6713920625b82df2b55728b2cbb9f7f3df2025 (diff) | |
download | dexon-8baa0f84e70aafa3882ec477d3b3d401d462958b.tar dexon-8baa0f84e70aafa3882ec477d3b3d401d462958b.tar.gz dexon-8baa0f84e70aafa3882ec477d3b3d401d462958b.tar.bz2 dexon-8baa0f84e70aafa3882ec477d3b3d401d462958b.tar.lz dexon-8baa0f84e70aafa3882ec477d3b3d401d462958b.tar.xz dexon-8baa0f84e70aafa3882ec477d3b3d401d462958b.tar.zst dexon-8baa0f84e70aafa3882ec477d3b3d401d462958b.zip |
Fixed reverting error
Diffstat (limited to 'ethchain/vm.go')
-rw-r--r-- | ethchain/vm.go | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/ethchain/vm.go b/ethchain/vm.go index 35443a6ba..97379f8ea 100644 --- a/ethchain/vm.go +++ b/ethchain/vm.go @@ -82,7 +82,7 @@ func (self *Vm) Printf(format string, v ...interface{}) *Vm { func (self *Vm) Endl() *Vm { if self.Verbose { - vmlogger.Infoln(self.logStr) + vmlogger.Debugln(self.logStr) self.logStr = "" } @@ -652,7 +652,7 @@ func (vm *Vm) RunClosure(closure *Closure) (ret []byte, err error) { c := NewClosure(closure, contract, contract.initScript, vm.state, gas, closure.Price) // Call the closure and set the return value as // main script. - contract.script, err, _ = Call(vm, c, nil) + contract.script, err = Call(vm, c, nil) } else { err = fmt.Errorf("Insufficient funds to transfer value. Req %v, has %v", value, closure.object.Amount) } @@ -690,25 +690,24 @@ func (vm *Vm) RunClosure(closure *Closure) (ret []byte, err error) { stack.Push(ethutil.BigFalse) } else { - snapshot := vm.state.Copy() + //snapshot := vm.state.Copy() stateObject := vm.state.GetOrNewStateObject(addr.Bytes()) closure.object.SubAmount(value) - // Add the value to the state object stateObject.AddAmount(value) // Create a new callable closure closure := NewClosure(closure, stateObject, stateObject.script, vm.state, gas, closure.Price) // Executer the closure and get the return value (if any) - ret, err, _ := Call(vm, closure, args) + ret, err := Call(vm, closure, args) if err != nil { stack.Push(ethutil.BigFalse) vmlogger.Debugf("Closure execution failed. %v\n", err) - vm.err = err - vm.state.Set(snapshot) + //vm.state.Set(snapshot) + vm.state.ResetStateObject(stateObject) } else { stack.Push(ethutil.BigTrue) |