mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
Set remaining gas to 0 if OOG exception
This commit is contained in:
parent
eaa2890366
commit
2c10328ef9
1 changed files with 4 additions and 3 deletions
|
|
@ -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))
|
r := C.evmjit_run(unsafe.Pointer(&data), unsafe.Pointer(self))
|
||||||
//fmt.Printf("JIT result: %d\n", r)
|
//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 {
|
if r >= 100 {
|
||||||
err = errors.New("OOG from JIT")
|
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
|
return ret, err
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue