Make sure staking migration code runs only for version = 2_0_0 (#5768)

This commit is contained in:
Bastian Köcher
2020-04-24 12:35:25 +02:00
committed by GitHub
parent 61f383a116
commit dd31fae56c
+6 -2
View File
@@ -1246,8 +1246,12 @@ decl_module! {
fn on_runtime_upgrade() -> Weight {
// For Kusama the type hasn't actually changed as Moment was u64 and was the number of
// millisecond since unix epoch.
StorageVersion::put(Releases::V3_0_0);
Self::migrate_last_reward_to_claimed_rewards();
StorageVersion::mutate(|v| {
if matches!(v, Releases::V2_0_0) {
Self::migrate_last_reward_to_claimed_rewards();
}
*v = Releases::V3_0_0;
});
0
}