aboutsummaryrefslogtreecommitdiffstats
path: root/core/execution.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/execution.go')
-rw-r--r--core/execution.go15
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
}