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. 12
      ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/StateTestSubCommand.java

@ -201,9 +201,15 @@ public class StateTestSubCommand implements Runnable {
TransactionValidationParams.processingBlock(), TransactionValidationParams.processingBlock(),
tracer); tracer);
timer.stop(); timer.stop();
final Account coinbase = worldStateUpdater.getOrCreate(spec.getBlockHeader().getCoinbase()); if (shouldClearEmptyAccounts(spec.getFork())) {
if (coinbase != null && coinbase.isEmpty() && shouldClearEmptyAccounts(spec.getFork())) { final Account coinbase = worldStateUpdater.getOrCreate(spec.getBlockHeader().getCoinbase());
worldStateUpdater.deleteAccount(coinbase.getAddress()); 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(); worldStateUpdater.commit();

Loading…
Cancel
Save