From 30a38c4438810d15f273f5127e8119a9e2ee6ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Wed, 12 Oct 2016 17:05:37 +0200 Subject: [PATCH] Additional cost of SELFDESTRUCT sending to non-existing account This implements version 1c of EIP150 https://github.com/ethereum/EIPs/issues/150. --- libevm/VM.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libevm/VM.cpp b/libevm/VM.cpp index 45cd97a2b5d..d5c3683cd21 100755 --- a/libevm/VM.cpp +++ b/libevm/VM.cpp @@ -187,10 +187,15 @@ void VM::interpretCases() CASE_BEGIN(SUICIDE) { m_runGas = toUint64(m_schedule->suicideGas); + Address dest = asAddress(*m_sp); + + // After EIP150 hard fork charge additional cost of sending + // ethers to non-existing account. + if (!m_schedule->staticCallDepthLimit && !m_ext->exists(dest)) + m_runGas += m_schedule->callNewAccountGas; + onOperation(); updateIOGas(); - - Address dest = asAddress(*m_sp); m_ext->suicide(dest); m_bounce = 0; }