aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/interpreter.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-08-16 22:09:29 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-08-17 21:50:35 +0800
commitf9fb70d2eeebfc27d3a4f8ae3ea93c67d7fb0e6b (patch)
treeea623fa39c51265de09020ead1840ba881748bc9 /core/vm/interpreter.go
parentb70a73cd3e49e249a9ab2c41c2dd268786dcd1a3 (diff)
downloaddexon-f9fb70d2eeebfc27d3a4f8ae3ea93c67d7fb0e6b.tar.gz
dexon-f9fb70d2eeebfc27d3a4f8ae3ea93c67d7fb0e6b.tar.zst
dexon-f9fb70d2eeebfc27d3a4f8ae3ea93c67d7fb0e6b.zip
core/vm: rework reversion to work on a higher level
Diffstat (limited to 'core/vm/interpreter.go')
-rw-r--r--core/vm/interpreter.go14
1 files changed, 6 insertions, 8 deletions
diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go
index 23f930e91..0466bf085 100644
--- a/core/vm/interpreter.go
+++ b/core/vm/interpreter.go
@@ -209,24 +209,22 @@ func (in *Interpreter) Run(snapshot int, contract *Contract, input []byte) (ret
if verifyPool {
verifyIntegerPool(in.intPool)
}
- // checks whether the operation should revert state.
- if operation.reverts {
- in.evm.StateDB.RevertToSnapshot(snapshot)
+ // if the operation clears the return data (e.g. it has returning data)
+ // set the last return to the result of the operation.
+ if operation.returns {
+ in.returnData = res
}
switch {
case err != nil:
return nil, err
+ case operation.reverts:
+ return res, errExecutionReverted
case operation.halts:
return res, nil
case !operation.jumps:
pc++
}
- // if the operation clears the return data (e.g. it has returning data)
- // set the last return to the result of the operation.
- if operation.returns {
- in.returnData = res
- }
}
return nil, nil
}