Introduce OnReapAccount (#4585)

* Initial run and gun at `OnReapAccount`

* Fix some imports

* More fixes

* Whitespace

* More wack-a-mole

* Gotta catch em all

* Update lib.rs

* Small doc update

* Whitespace
This commit is contained in:
Shawn Tabrizi
2020-01-10 01:46:23 +01:00
committed by Gavin Wood
parent 78c73e76c3
commit a1e0076aa8
19 changed files with 57 additions and 5 deletions
+8 -1
View File
@@ -113,7 +113,7 @@ use sp_runtime::{
use sp_core::storage::well_known_keys;
use frame_support::{
decl_module, decl_event, decl_storage, decl_error, storage, Parameter,
traits::{Contains, Get, ModuleToIndex},
traits::{Contains, Get, ModuleToIndex, OnReapAccount},
weights::{Weight, DispatchInfo, DispatchClass, SimpleDispatchInfo},
};
use codec::{Encode, Decode};
@@ -789,6 +789,13 @@ impl<T: Trait> Module<T> {
}
}
impl<T: Trait> OnReapAccount<T::AccountId> for Module<T> {
/// Remove the nonce for the account. Account is considered fully removed from the system.
fn on_reap_account(who: &T::AccountId) {
<AccountNonce<T>>::remove(who);
}
}
/// resource limit check.
#[derive(Encode, Decode, Clone, Eq, PartialEq)]
pub struct CheckWeight<T: Trait + Send + Sync>(PhantomData<T>);