From aabd5d3302e03d019d5c66337c72dea6f12acb0f Mon Sep 17 00:00:00 2001 From: matkt Date: Wed, 14 Apr 2021 13:11:42 +0200 Subject: [PATCH] Fix invalid result during EVM test (#2135) Fix invalid result during EVM test. The sender's account was not deleted when empty Signed-off-by: Karim TAAM --- .../besu/evmtool/StateTestSubCommand.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/StateTestSubCommand.java b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/StateTestSubCommand.java index 1996dcddb4..98212b94f7 100644 --- a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/StateTestSubCommand.java +++ b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/StateTestSubCommand.java @@ -201,9 +201,15 @@ public class StateTestSubCommand implements Runnable { TransactionValidationParams.processingBlock(), tracer); timer.stop(); - final Account coinbase = worldStateUpdater.getOrCreate(spec.getBlockHeader().getCoinbase()); - if (coinbase != null && coinbase.isEmpty() && shouldClearEmptyAccounts(spec.getFork())) { - worldStateUpdater.deleteAccount(coinbase.getAddress()); + if (shouldClearEmptyAccounts(spec.getFork())) { + final Account coinbase = worldStateUpdater.getOrCreate(spec.getBlockHeader().getCoinbase()); + if (coinbase != null && coinbase.isEmpty()) { + worldStateUpdater.deleteAccount(coinbase.getAddress()); + } + final Account sender = worldStateUpdater.getOrCreateSenderAccount(transaction.getSender()); + if (sender != null && sender.isEmpty()) { + worldStateUpdater.deleteAccount(sender.getAddress()); + } } worldStateUpdater.commit();