From 29791690c3fc318dd2fc02fc9afc59513da96ea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Wed, 2 Sep 2026 11:41:54 +0200 Subject: [PATCH] evm: Improve readability of SELFDESTRUCT refund --- lib/evmone/instructions.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/evmone/instructions.hpp b/lib/evmone/instructions.hpp index ed7de4806c..76c6a63216 100644 --- a/lib/evmone/instructions.hpp +++ b/lib/evmone/instructions.hpp @@ -1087,11 +1087,11 @@ inline TermResult selfdestruct(StackTop stack, int64_t gas_left, ExecutionState& } } - if (state.host.selfdestruct(state.msg->recipient, beneficiary)) - { - if (state.rev < EVMC_LONDON) - state.gas_refund += 24000; - } + const auto first_time = state.host.selfdestruct(state.msg->recipient, beneficiary); + + if (first_time && state.rev < EVMC_LONDON) + state.gas_refund += 24000; + return {EVMC_SUCCESS, gas_left}; }