diff options
author | obscuren <geffobscura@gmail.com> | 2014-12-20 09:21:13 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-12-20 09:21:13 +0800 |
commit | 1508a23a6fe3cc50f718bfd6c62caae056534c09 (patch) | |
tree | 78853077f6b961bf27c5bdf74673c255e96aba1d /core/execution.go | |
parent | f5b8f3d41b533d51eb81e895ed9b6aa31d7aaaef (diff) | |
download | go-tangerine-1508a23a6fe3cc50f718bfd6c62caae056534c09.tar.gz go-tangerine-1508a23a6fe3cc50f718bfd6c62caae056534c09.tar.zst go-tangerine-1508a23a6fe3cc50f718bfd6c62caae056534c09.zip |
Minor updates on gas and removed/refactored old code.
Diffstat (limited to 'core/execution.go')
-rw-r--r-- | core/execution.go | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/core/execution.go b/core/execution.go index 44dbd3ace..b7eead0dd 100644 --- a/core/execution.go +++ b/core/execution.go @@ -3,6 +3,7 @@ package core import ( "fmt" "math/big" + "time" "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/vm" @@ -12,7 +13,6 @@ type Execution struct { env vm.Environment address, input []byte Gas, price, value *big.Int - object *state.StateObject SkipTransfer bool } @@ -35,8 +35,6 @@ func (self *Execution) exec(code, contextAddr []byte, caller vm.ClosureRef) (ret env := self.env evm := vm.New(env, vm.DebugVmTy) - chainlogger.Debugf("pre state %x\n", env.State().Root()) - if env.Depth() == vm.MaxCallDepth { // Consume all gas (by not returning it) and return a depth error return nil, vm.DepthError{} @@ -55,13 +53,12 @@ func (self *Execution) exec(code, contextAddr []byte, caller vm.ClosureRef) (ret } snapshot := env.State().Copy() - defer func() { - env.State().Set(snapshot) - chainlogger.Debugf("post state %x\n", env.State().Root()) - }() - - self.object = to + start := time.Now() ret, err = evm.Run(to, caller, code, self.value, self.Gas, self.price, self.input) + if err != nil { + env.State().Set(snapshot) + } + chainlogger.Debugf("vm took %v\n", time.Since(start)) return } |