From 2c10328ef9b40f25182a86ff81d170acd56aeb77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Thu, 15 Jan 2015 15:23:25 +0100 Subject: [PATCH] Set remaining gas to 0 if OOG exception --- vm/vm_jit.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vm/vm_jit.go b/vm/vm_jit.go index 76b5776e7d..6cbee96d60 100644 --- a/vm/vm_jit.go +++ b/vm/vm_jit.go @@ -149,11 +149,12 @@ func (self *JitVm) Run(me, caller ContextRef, code []byte, value, gas, price *bi r := C.evmjit_run(unsafe.Pointer(&data), unsafe.Pointer(self)) //fmt.Printf("JIT result: %d\n", r) - gasLeft := llvm2big(&data.elems[Gas]) // TODO: Set value directly to gas instance - gas.Set(gasLeft) - if r >= 100 { err = errors.New("OOG from JIT") + gas.SetInt64(0) // Set gas to 0, JIT do not bother + } else { + gasLeft := llvm2big(&data.elems[Gas]) // TODO: Set value directly to gas instance + gas.Set(gasLeft) } return ret, err