Check current call depth

This commit is contained in:
Paweł Bylica 2014-12-12 18:51:53 +01:00
parent 70348d9586
commit 6e318f8816

View file

@ -49,6 +49,8 @@ extern "C"
EXPORT void env_create(ExtVMFace* _env, i256* _endowment, byte* _initBeg, uint64_t _initSize, h256* o_address)
{
assert(_env->depth < 1024); // TODO: Handle call depth
auto endowment = llvm2eth(*_endowment);
if (_env->balance(_env->myAddress) >= endowment)
@ -65,6 +67,8 @@ extern "C"
EXPORT bool env_call(ExtVMFace* _env, i256* io_gas, h256* _receiveAddress, i256* _value, byte* _inBeg, uint64_t _inSize, byte* _outBeg, uint64_t _outSize, h256* _codeAddress)
{
assert(_env->depth < 32); // TODO: Handle call depth
auto value = llvm2eth(*_value);
if (_env->balance(_env->myAddress) >= value)
{