fn rotate_staking_info(current_era: EraIndex) -> u64 {
			let next_era = current_era + 1;

			let mut consumed_weight = 0;

			for (provider_id, provider_info) in RegisteredProviders::<T>::iter() {
				// Ignore provider if it was unregistered
				consumed_weight = consumed_weight.saturating_add(T::DbWeight::get().reads(1));
				if let ProviderState::Unregistered(_) = provider_info.state {
					continue
				}

				// Copy data from era `X` to era `X + 1`
				if let Some(mut staking_info) = Self::provider_stake_info(&provider_id, current_era)
				{
					staking_info.provider_reward_claimed = false;
					ProviderEraStake::<T>::insert(&provider_id, next_era, staking_info);

					consumed_weight =
						consumed_weight.saturating_add(T::DbWeight::get().reads_writes(1, 1));
				} else {
					consumed_weight = consumed_weight.saturating_add(T::DbWeight::get().reads(1));
				}
			}

			consumed_weight
		}
/// Used to copy all `ProviderStakeInfo` from the ending era over to the next era.
/// This is the most primitive solution since it scales with number of providers.
/// It is possible to provide a hybrid solution which allows laziness but also prevents
/// a situation where we don't have access to the required data.
Used to copy all `ProviderStakeInfo` from the ending era over to the next era.
This is the most primitive solution since it scales with number of providers.
It is possible to provide a hybrid solution which allows laziness but also prevents
a situation where we don't have access to the required data.
Used to copy all ` ProviderStakeInfo ` from the ending era over to the next era . This is the most primitive solution since it scales with number of providers . It is possible to provide a hybrid solution which allows laziness but also prevents a situation where we don ' t have access to the required data .
fn rotate_staking_info(current_era: EraIndex) -> u64 {
			let next_era = current_era + 1;
			let mut consumed_weight = 0;
			for (provider_id, provider_info) in RegisteredProviders::<T>::iter() {
				// Ignore provider if it was unregistered
				consumed_weight = consumed_weight.saturating_add(T::DbWeight::get().reads(1));
				if let ProviderState::Unregistered(_) = provider_info.state {
					continue
				}
				// Copy data from era `X` to era `X + 1`
				if let Some(mut staking_info) = Self::provider_stake_info(&provider_id, current_era)
				{
					staking_info.provider_reward_claimed = false;
					ProviderEraStake::<T>::insert(&provider_id, next_era, staking_info);
					consumed_weight =
						consumed_weight.saturating_add(T::DbWeight::get().reads_writes(1, 1));
				} else {
					consumed_weight = consumed_weight.saturating_add(T::DbWeight::get().reads(1));
				}
			}
			consumed_weight
		}
fn rotate_staking_info ( current_era : EraIndex ) -> u64 { let next_era = current_era + 1 ; let mut consumed_weight = 0 ; for ( provider_id , provider_info ) in RegisteredProviders :: < T > :: iter ( ) { // Ignore provider if it was unregistered consumed_weight = consumed_weight . saturating_add ( T :: DbWeight :: get ( ) . reads ( 1 ) ) ; if let ProviderState :: Unregistered ( _ ) = provider_info . state { continue } // Copy data from era `X` to era `X + 1` if let Some ( mut staking_info ) = Self :: provider_stake_info ( & provider_id , current_era ) { staking_info . provider_reward_claimed = false ; ProviderEraStake :: < T > :: insert ( & provider_id , next_era , staking_info ) ; consumed_weight = consumed_weight . saturating_add ( T :: DbWeight :: get ( ) . reads_writes ( 1 , 1 ) ) ; } else { consumed_weight = consumed_weight . saturating_add ( T :: DbWeight :: get ( ) . reads ( 1 ) ) ; } } consumed_weight }
Used to copy all `ProviderStakeInfo` from the ending era over to the next era.
Used to copy all ` ProviderStakeInfo ` from the ending era over to the next era .
current_era
EraIndex