contracts: Remove OnKilledAccount implementation (#5397)

* contracts: Remove OnKilledAccount implementation

Contracts now longer rely on this callback to tell them when they
are removed. Instead, they can only self destruct  using `ext_terminate`.

* Fix account removal test

* Fix account storage removal
This commit is contained in:
Alexander Theißen
2020-03-26 11:16:24 +01:00
committed by GitHub
parent b0d2f4b173
commit 7cbadd73be
3 changed files with 16 additions and 28 deletions
@@ -146,16 +146,8 @@ impl<T: Trait> AccountDb<T> for DirectAccountDb {
let mut total_imbalance = SignedImbalance::zero();
for (address, changed) in s.into_iter() {
if let Some(balance) = changed.balance() {
let existed = !T::Currency::total_balance(&address).is_zero();
let imbalance = T::Currency::make_free_balance_be(&address, balance);
let exists = !T::Currency::total_balance(&address).is_zero();
total_imbalance = total_imbalance.merge(imbalance);
if existed && !exists {
// Account killed. This will ultimately lead to calling `OnKilledAccount` callback
// which will make removal of CodeHashOf and AccountStorage for this account.
// In order to avoid writing over the deleted properties we `continue` here.
continue;
}
}
if changed.code_hash().is_some()