From 02316e3c21ca13f273e334552999c2b3893d1587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Mon, 9 Mar 2015 16:28:59 +0100 Subject: [PATCH] PoC-9 call depth handling update --- libevmjit-cpp/Env.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/libevmjit-cpp/Env.cpp b/libevmjit-cpp/Env.cpp index 39007c59d..42a0b1e12 100644 --- a/libevmjit-cpp/Env.cpp +++ b/libevmjit-cpp/Env.cpp @@ -86,18 +86,16 @@ extern "C" if (*io_gas < 0) return false; + auto ret = false; + auto callGas = u256{_callGas}; if (_env->balance(_env->myAddress) >= value && _env->depth < 1024) { _env->subBalance(value); - auto inRef = bytesConstRef{_inBeg, _inSize}; - auto outRef = bytesRef{_outBeg, _outSize}; - u256 callGas = _callGas; - auto ret = _env->call(receiveAddress, value, inRef, callGas, outRef, {}, {}, codeAddress); - *io_gas += static_cast(callGas); // It is never more than initial _callGas - return ret; + ret = _env->call(receiveAddress, value, {_inBeg, _inSize}, callGas, {_outBeg, _outSize}, {}, {}, codeAddress); } - return false; + *io_gas += static_cast(callGas); // it is never more than initial _callGas + return ret; } EXPORT void env_sha3(byte* _begin, uint64_t _size, h256* o_hash)