From 9688ebef523fdd368f7d0596f4529b7e3bc26775 Mon Sep 17 00:00:00 2001
From: obscuren <geffobscura@gmail.com>
Date: Thu, 10 Jul 2014 15:31:48 +0200
Subject: [PATCH] Return from execution immediately if there's no code

---
 ethchain/vm.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ethchain/vm.go b/ethchain/vm.go
index 56456fdab..c63b5392f 100644
--- a/ethchain/vm.go
+++ b/ethchain/vm.go
@@ -107,6 +107,11 @@ func (vm *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
 		}
 	}()
 
+	// Don't bother with the execution if there's no code.
+	if len(closure.Script) == 0 {
+		return closure.Return(nil), nil
+	}
+
 	vmlogger.Debugf("(%s) %x gas: %v (d) %x\n", vm.Fn, closure.object.Address(), closure.Gas, closure.Args)
 
 	var (
-- 
GitLab