Commit 48fb0c32 authored by Felix Lange's avatar Felix Lange

core/vm: check for 'no code' before doing any work

parent ea2718c9
...@@ -71,6 +71,11 @@ func (self *Vm) Run(context *Context, callData []byte) (ret []byte, err error) { ...@@ -71,6 +71,11 @@ func (self *Vm) Run(context *Context, callData []byte) (ret []byte, err error) {
} }
} }
// Don't bother with the execution if there's no code.
if len(code) == 0 {
return context.Return(nil), nil
}
var ( var (
op OpCode op OpCode
codehash = crypto.Sha3Hash(code) codehash = crypto.Sha3Hash(code)
...@@ -94,11 +99,6 @@ func (self *Vm) Run(context *Context, callData []byte) (ret []byte, err error) { ...@@ -94,11 +99,6 @@ func (self *Vm) Run(context *Context, callData []byte) (ret []byte, err error) {
} }
) )
// Don't bother with the execution if there's no code.
if len(code) == 0 {
return context.Return(nil), nil
}
for { for {
// The base for all big integer arithmetic // The base for all big integer arithmetic
base := new(big.Int) base := new(big.Int)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment