diff --git a/pallets/parachain-staking/src/migrations.rs b/pallets/parachain-staking/src/migrations.rs index 2a7e1047..6a894b8a 100644 --- a/pallets/parachain-staking/src/migrations.rs +++ b/pallets/parachain-staking/src/migrations.rs @@ -3,7 +3,7 @@ use crate::{ pallet::{Config, Pallet, OLD_STAKING_ID, STAKING_ID}, types::{AccountIdOf, Candidate, OldCandidate}, - CandidatePool, ForceNewRound, + CandidatePool, ForceNewRound, Round, }; use frame_support::{ pallet_prelude::{GetStorageVersion, StorageVersion, ValueQuery}, @@ -94,9 +94,16 @@ mod upgrade { Versions::default() as u16 ); - // force start new session - >::put(true); - weight_writes += 1; + let round = Round::::get(); + let now = >::block_number(); + weight_reads += 2; + // Force new round if round wasn't about to be rotated anyway + if !round.should_update(now) { + // force start new session + >::put(true); + weight_writes += 1; + log::info!("Will force new round for token economy V2."); + } log::info!("V11 Migrating Done."); }