fix(executor): do not destroy empty accounts (#2630)

This commit is contained in:
Roman Krasiuk
2023-05-12 20:52:13 +03:00
committed by GitHub
parent 34e34177f1
commit 059e9c9a29

View File

@@ -393,9 +393,13 @@ pub fn commit_state_changes<DB>(
panic!("Left panic to critically jumpout if happens, as every account should be hot loaded.");
}
};
// Insert into `change` a old account and None for new account
// and mark storage to be mapped
post_state.destroy_account(block_number, address, to_reth_acc(&db_account.info));
let old = to_reth_acc(&db_account.info);
if !old.is_empty() {
// Insert into `change` a old account and None for new account
// and mark storage to be wiped
post_state.destroy_account(block_number, address, to_reth_acc(&db_account.info));
}
// clear cached DB and mark account as not existing
db_account.storage.clear();