im-online removal cleanup: remove off-chain storage (#2290)

This is a follow-up for `im-online` pallet removal that is cleaning up
its off-chain storage. Must be merged no earlier than #2265 is enacted.
Related: #1964

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
s0me0ne-unkn0wn
2024-02-19 10:39:34 +01:00
committed by GitHub
parent 3168ed4d6a
commit a5492dc6ba
4 changed files with 37 additions and 0 deletions
+6
View File
@@ -1824,6 +1824,12 @@ sp_api::impl_runtime_apis! {
impl offchain_primitives::OffchainWorkerApi<Block> for Runtime {
fn offchain_worker(header: &<Block as BlockT>::Header) {
use sp_runtime::{traits::Header, DigestItem};
if header.digest().logs().iter().any(|di| di == &DigestItem::RuntimeEnvironmentUpdated) {
pallet_im_online::migration::clear_offchain_storage(Session::validators().len() as u32);
}
Executive::offchain_worker(header)
}
}