Skip to content
This repository was archived by the owner on Oct 28, 2021. It is now read-only.

Commit e701f4e

Browse files
committed
Simplify LegacyVM's SUICIDE logic
1 parent 1aad58d commit e701f4e

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

libethcore/EVMSchedule.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ struct EVMSchedule
8383
boost::optional<u256> blockRewardOverwrite;
8484

8585
bool staticCallDepthLimit() const { return !eip150Mode; }
86-
bool suicideChargesNewAccountGas() const { return eip150Mode; }
8786
bool emptinessIsNonexistence() const { return eip158Mode; }
8887
bool zeroValueTransferChargesNewAccountGas() const { return !eip158Mode; }
8988
};

libevm/LegacyVM.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -338,12 +338,11 @@ void LegacyVM::interpretCases()
338338
// Starting with EIP150, self-destructs need to pay both gas cost and account creation
339339
// gas cost. Starting with EIP158, 0-value self-destructs don't need to pay this account
340340
// creation cost.
341-
if (m_schedule->zeroValueTransferChargesNewAccountGas() ||
342-
m_schedule->suicideChargesNewAccountGas())
343-
if (m_schedule->zeroValueTransferChargesNewAccountGas() ||
344-
m_ext->balance(m_ext->myAddress) > 0)
345-
if (m_schedule->suicideChargesNewAccountGas() && !m_ext->exists(dest))
346-
m_runGas += m_schedule->callNewAccountGas;
341+
if (m_schedule->eip150Mode && (!m_schedule->eip158Mode || m_ext->balance(dest) > 0))
342+
{
343+
if (!m_ext->exists(dest))
344+
m_runGas += m_schedule->callNewAccountGas;
345+
}
347346

348347
updateIOGas();
349348
m_ext->suicide(dest);

0 commit comments

Comments
 (0)