aboutsummaryrefslogtreecommitdiffstats
path: root/core/execution.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-10 08:22:38 +0800
committerobscuren <geffobscura@gmail.com>2015-03-10 08:22:38 +0800
commit0db4a0e898d09ffa7b6b1289e9a334edc0001cfa (patch)
treea0b5c8381ab482550ef4800a06d4db086d76a983 /core/execution.go
parent94e543bc398efbb5c712b6e4cb48d8a57eb3400d (diff)
parent0d64163fea3a266ceb71cb4c4ee5682052c9ca6c (diff)
downloadgo-tangerine-0db4a0e898d09ffa7b6b1289e9a334edc0001cfa.tar
go-tangerine-0db4a0e898d09ffa7b6b1289e9a334edc0001cfa.tar.gz
go-tangerine-0db4a0e898d09ffa7b6b1289e9a334edc0001cfa.tar.bz2
go-tangerine-0db4a0e898d09ffa7b6b1289e9a334edc0001cfa.tar.lz
go-tangerine-0db4a0e898d09ffa7b6b1289e9a334edc0001cfa.tar.xz
go-tangerine-0db4a0e898d09ffa7b6b1289e9a334edc0001cfa.tar.zst
go-tangerine-0db4a0e898d09ffa7b6b1289e9a334edc0001cfa.zip
Merge branch 'poc-9' into develop
Diffstat (limited to 'core/execution.go')
-rw-r--r--core/execution.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/core/execution.go b/core/execution.go
index 5e0cbd37e..4a69cce09 100644
--- a/core/execution.go
+++ b/core/execution.go
@@ -1,7 +1,6 @@
package core
import (
- "fmt"
"math/big"
"time"
@@ -26,7 +25,10 @@ func (self *Execution) Addr() []byte {
func (self *Execution) Call(codeAddr []byte, caller vm.ContextRef) ([]byte, error) {
// Retrieve the executing code
- code := self.env.State().GetCode(codeAddr)
+ var code []byte
+ if self.env.State().GetStateObject(codeAddr) != nil {
+ code = self.env.State().GetCode(codeAddr)
+ }
return self.exec(code, codeAddr, caller)
}
@@ -55,16 +57,16 @@ func (self *Execution) exec(code, contextAddr []byte, caller vm.ContextRef) (ret
caller.ReturnGas(self.Gas, self.price)
- return nil, fmt.Errorf("insufficient funds to transfer value. Req %v, has %v", self.value, from.Balance())
+ return nil, ValueTransferErr("insufficient funds to transfer value. Req %v, has %v", self.value, from.Balance())
}
snapshot := env.State().Copy()
start := time.Now()
ret, err = evm.Run(to, caller, code, self.value, self.Gas, self.price, self.input)
+ chainlogger.Debugf("vm took %v\n", time.Since(start))
if err != nil {
env.State().Set(snapshot)
}
- chainlogger.Debugf("vm took %v\n", time.Since(start))
return
}