diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-06 02:51:25 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-06 02:51:25 +0800 |
commit | 88ff13c241faff1d58e47f12bd283c112de7225a (patch) | |
tree | b7bd2595ba702c086d8226cca4adaeeee0505bd5 /core/execution.go | |
parent | ca1093f8485595b34781307eb2b673d0d81d8fb9 (diff) | |
download | go-tangerine-88ff13c241faff1d58e47f12bd283c112de7225a.tar.gz go-tangerine-88ff13c241faff1d58e47f12bd283c112de7225a.tar.zst go-tangerine-88ff13c241faff1d58e47f12bd283c112de7225a.zip |
Spec changes.
* All errors during state transition result in an invalid tx
Diffstat (limited to 'core/execution.go')
-rw-r--r-- | core/execution.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/execution.go b/core/execution.go index f7d5a8945..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,7 +57,7 @@ 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() |