diff options
author | Felix Lange <fjl@twurst.com> | 2015-05-29 20:58:57 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-06-03 22:25:06 +0800 |
commit | 48fb0c3213a1634a266dd661d30c9ecd3c352f49 (patch) | |
tree | 1624cc57b661ae369e7d69dedee7209c88e76e86 /core | |
parent | ea2718c9462ae351baab5eaa05a7e1ef9dc916fa (diff) | |
download | dexon-48fb0c3213a1634a266dd661d30c9ecd3c352f49.tar.gz dexon-48fb0c3213a1634a266dd661d30c9ecd3c352f49.tar.zst dexon-48fb0c3213a1634a266dd661d30c9ecd3c352f49.zip |
core/vm: check for 'no code' before doing any work
Diffstat (limited to 'core')
-rw-r--r-- | core/vm/vm.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/core/vm/vm.go b/core/vm/vm.go index 0d8facbb6..2bd950385 100644 --- a/core/vm/vm.go +++ b/core/vm/vm.go @@ -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 ( op OpCode codehash = crypto.Sha3Hash(code) @@ -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 { // The base for all big integer arithmetic base := new(big.Int) |