pub fn rotate_session(is_final_block: bool, apply_rewards: bool) {
		let now = <timestamp::Module<T>>::get();
		let time_elapsed = now.clone() - Self::current_start();
		let session_index = <CurrentIndex<T>>::get() + One::one();

		Self::deposit_event(RawEvent::NewSession(session_index));

		// Increment current session index.
		<CurrentIndex<T>>::put(session_index);
		<CurrentStart<T>>::put(now);

		// Enact session length change.
		let len_changed = if let Some(next_len) = <NextSessionLength<T>>::take() {
			<SessionLength<T>>::put(next_len);
			true
		} else {
			false
		};
		if len_changed || !is_final_block {
			let block_number = <system::Module<T>>::block_number();
			<LastLengthChange<T>>::put(block_number);
		}

		T::OnSessionChange::on_session_change(time_elapsed, apply_rewards);

		// Update any changes in session keys.
		let v = Self::validators();
		<consensus::Module<T>>::set_authority_count(v.len() as u32);
		for (i, v) in v.into_iter().enumerate() {
			<consensus::Module<T>>::set_authority(
				i as u32,
				&<NextKeyFor<T>>::get(&v)
					.or_else(|| T::ConvertAccountIdToSessionKey::convert(v))
					.unwrap_or_default()
			);
		};
	}
/// Move on to next session: register the new authority set.
Move on to next session: register the new authority set.
Move on to next session : register the new authority set .
pub fn rotate_session(is_final_block: bool, apply_rewards: bool) {
		let now = <timestamp::Module<T>>::get();
		let time_elapsed = now.clone() - Self::current_start();
		let session_index = <CurrentIndex<T>>::get() + One::one();
		Self::deposit_event(RawEvent::NewSession(session_index));
		// Increment current session index.
		<CurrentIndex<T>>::put(session_index);
		<CurrentStart<T>>::put(now);
		// Enact session length change.
		let len_changed = if let Some(next_len) = <NextSessionLength<T>>::take() {
			<SessionLength<T>>::put(next_len);
			true
		} else {
			false
		};
		if len_changed || !is_final_block {
			let block_number = <system::Module<T>>::block_number();
			<LastLengthChange<T>>::put(block_number);
		}
		T::OnSessionChange::on_session_change(time_elapsed, apply_rewards);
		// Update any changes in session keys.
		let v = Self::validators();
		<consensus::Module<T>>::set_authority_count(v.len() as u32);
		for (i, v) in v.into_iter().enumerate() {
			<consensus::Module<T>>::set_authority(
				i as u32,
				&<NextKeyFor<T>>::get(&v)
					.or_else(|| T::ConvertAccountIdToSessionKey::convert(v))
					.unwrap_or_default()
			);
		};
	}
pub fn rotate_session ( is_final_block : bool , apply_rewards : bool ) { let now = < timestamp :: Module < T > > :: get ( ) ; let time_elapsed = now . clone ( ) - Self :: current_start ( ) ; let session_index = < CurrentIndex < T > > :: get ( ) + One :: one ( ) ; Self :: deposit_event ( RawEvent :: NewSession ( session_index ) ) ; // Increment current session index. < CurrentIndex < T > > :: put ( session_index ) ; < CurrentStart < T > > :: put ( now ) ; // Enact session length change. let len_changed = if let Some ( next_len ) = < NextSessionLength < T > > :: take ( ) { < SessionLength < T > > :: put ( next_len ) ; true } else { false } ; if len_changed || ! is_final_block { let block_number = < system :: Module < T > > :: block_number ( ) ; < LastLengthChange < T > > :: put ( block_number ) ; } T :: OnSessionChange :: on_session_change ( time_elapsed , apply_rewards ) ; // Update any changes in session keys. let v = Self :: validators ( ) ; < consensus :: Module < T > > :: set_authority_count ( v . len ( ) as u32 ) ; for ( i , v ) in v . into_iter ( ) . enumerate ( ) { < consensus :: Module < T > > :: set_authority ( i as u32 , & < NextKeyFor < T > > :: get ( & v ) . or_else ( | | T :: ConvertAccountIdToSessionKey :: convert ( v ) ) . unwrap_or_default ( ) ) ; } ; }
Move on to next session: register the new authority set.
Move on to next session : register the new authority set .
is_final_block
bool
apply_rewards
bool
is_final_block
bool
apply_rewards
bool