aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-10-27 23:53:20 +0800
committerobscuren <geffobscura@gmail.com>2014-10-27 23:53:20 +0800
commitca18b3f1e971bc5329c8f3a3f174568d1bbad0b4 (patch)
treedc4c35b76598fd92250a5a684fd9f000d798f496
parent69e745c537e442d4086986b02c01741d2a314cf1 (diff)
downloaddexon-ca18b3f1e971bc5329c8f3a3f174568d1bbad0b4.tar.gz
dexon-ca18b3f1e971bc5329c8f3a3f174568d1bbad0b4.tar.zst
dexon-ca18b3f1e971bc5329c8f3a3f174568d1bbad0b4.zip
Do not return error on VM exception
-rw-r--r--ethchain/state_transition.go36
1 files changed, 12 insertions, 24 deletions
diff --git a/ethchain/state_transition.go b/ethchain/state_transition.go
index 542b7be13..e6863b61f 100644
--- a/ethchain/state_transition.go
+++ b/ethchain/state_transition.go
@@ -136,13 +136,6 @@ func (self *StateTransition) preCheck() (err error) {
func (self *StateTransition) TransitionState() (err error) {
statelogger.Debugf("(~) %x\n", self.tx.Hash())
- defer func() {
- if r := recover(); r != nil {
- statelogger.Infoln(r)
- err = fmt.Errorf("state transition err %v", r)
- }
- }()
-
// XXX Transactions after this point are considered valid.
if err = self.preCheck(); err != nil {
return
@@ -184,7 +177,7 @@ func (self *StateTransition) TransitionState() (err error) {
snapshot = self.state.Copy()
// Create a new state object for the contract
- receiver := MakeContract(tx, self.state)
+ receiver = MakeContract(tx, self.state)
self.rec = receiver
if receiver == nil {
return fmt.Errorf("Unable to create contract")
@@ -218,22 +211,22 @@ func (self *StateTransition) TransitionState() (err error) {
// script section for the state object.
self.data = nil
- code, err := self.Eval(msg, receiver.Init(), receiver)
- if err != nil {
+ code, evmerr := self.Eval(msg, receiver.Init(), receiver)
+ if evmerr != nil {
self.state.Set(snapshot)
- return fmt.Errorf("Error during init execution %v", err)
+ statelogger.Debugf("Error during init execution %v", evmerr)
}
receiver.Code = code
msg.Output = code
} else {
if len(receiver.Code) > 0 {
- ret, err := self.Eval(msg, receiver.Code, receiver)
- if err != nil {
+ ret, evmerr := self.Eval(msg, receiver.Code, receiver)
+ if evmerr != nil {
self.state.Set(snapshot)
- return fmt.Errorf("Error during code execution %v", err)
+ statelogger.Debugf("Error during code execution %v", evmerr)
}
msg.Output = ret
@@ -267,16 +260,11 @@ func (self *StateTransition) Eval(msg *ethstate.Message, script []byte, context
// Converts an transaction in to a state object
func MakeContract(tx *Transaction, state *ethstate.State) *ethstate.StateObject {
- // Create contract if there's no recipient
- if tx.IsContract() {
- addr := tx.CreationAddress(state)
+ addr := tx.CreationAddress(state)
- contract := state.GetOrNewStateObject(addr)
- contract.InitCode = tx.Data
- contract.State = ethstate.New(ethtrie.New(ethutil.Config.Db, ""))
+ contract := state.GetOrNewStateObject(addr)
+ contract.InitCode = tx.Data
+ contract.State = ethstate.New(ethtrie.New(ethutil.Config.Db, ""))
- return contract
- }
-
- return nil
+ return contract
}