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 <karim.t2am@gmail.com>
pull/2149/head
matkt 4 years ago committed by GitHub
parent 6fe29e5dd9
commit aabd5d3302
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/StateTestSubCommand.java

@ -201,10 +201,16 @@ public class StateTestSubCommand implements Runnable {
TransactionValidationParams.processingBlock(), TransactionValidationParams.processingBlock(),
tracer); tracer);
timer.stop(); timer.stop();
if (shouldClearEmptyAccounts(spec.getFork())) {
final Account coinbase = worldStateUpdater.getOrCreate(spec.getBlockHeader().getCoinbase()); final Account coinbase = worldStateUpdater.getOrCreate(spec.getBlockHeader().getCoinbase());
if (coinbase != null && coinbase.isEmpty() && shouldClearEmptyAccounts(spec.getFork())) { if (coinbase != null && coinbase.isEmpty()) {
worldStateUpdater.deleteAccount(coinbase.getAddress()); worldStateUpdater.deleteAccount(coinbase.getAddress());
} }
final Account sender = worldStateUpdater.getOrCreateSenderAccount(transaction.getSender());
if (sender != null && sender.isEmpty()) {
worldStateUpdater.deleteAccount(sender.getAddress());
}
}
worldStateUpdater.commit(); worldStateUpdater.commit();
final ObjectNode summaryLine = objectMapper.createObjectNode(); final ObjectNode summaryLine = objectMapper.createObjectNode();

Loading…
Cancel
Save