srml: consensus: kill storage (#2098)

* srml: consensus: kill storage items

* srml: consensus: add test for set and kill storage

* runtime: bump spec_version update wasm blobs
This commit is contained in:
André Silva
2019-03-25 23:39:23 +00:00
committed by GitHub
parent e2f5e40876
commit cee2166e4f
5 changed files with 35 additions and 2 deletions
+8
View File
@@ -51,6 +51,7 @@ impl<S: codec::Codec + Default> StorageVec for AuthorityStorageVec<S> {
const PREFIX: &'static [u8] = well_known_keys::AUTHORITY_PREFIX;
}
pub type Key = Vec<u8>;
pub type KeyValue = (Vec<u8>, Vec<u8>);
/// Handling offline validator reports in a generic way.
@@ -216,6 +217,13 @@ decl_module! {
}
}
/// Kill some items from storage.
fn kill_storage(keys: Vec<Key>) {
for key in &keys {
storage::unhashed::kill(&key);
}
}
fn on_finalise() {
if let Some(original_authorities) = <OriginalAuthorities<T>>::take() {
let current_authorities = AuthorityStorageVec::<T::SessionKey>::items();