Skip to content

Commit

Permalink
Fix invalid result during EVM test (hyperledger#2135)
Browse files Browse the repository at this point in the history
Fix invalid result during EVM test. The sender's account was not deleted when empty
Signed-off-by: Karim TAAM <karim.t2am@gmail.com>
  • Loading branch information
matkt authored Apr 14, 2021
1 parent 6fe29e5 commit aabd5d3
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,15 @@ private void traceTestSpecs(final String test, final List<GeneralStateTestCaseEi
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();

Expand Down

0 comments on commit aabd5d3

Please sign in to comment.