pub fn schedule_change(
		next_authorities: Vec<(T::SessionKey, u64)>,
		in_blocks: T::BlockNumber,
		forced: Option<T::BlockNumber>,
	) -> Result {
		use primitives::traits::As;

		if Self::pending_change().is_none() {
			let scheduled_at = system::ChainContext::<T>::default().current_height();

			if let Some(_) = forced {
				if Self::next_forced().map_or(false, |next| next > scheduled_at) {
					return Err("Cannot signal forced change so soon after last.");
				}

				// only allow the next forced change when twice the window has passed since
				// this one.
				<NextForced<T>>::put(scheduled_at + in_blocks * T::BlockNumber::sa(2));
			}

			<PendingChange<T>>::put(StoredPendingChange {
				delay: in_blocks,
				scheduled_at,
				next_authorities,
				forced,
			});

			Ok(())
		} else {
			Err("Attempt to signal GRANDPA change with one already pending.")
		}
	}
/// Schedule a change in the authorities.
///
/// The change will be applied at the end of execution of the block
/// `in_blocks` after the current block. This value may be 0, in which
/// case the change is applied at the end of the current block.
///
/// If the `forced` parameter is defined, this indicates that the current
/// set has been synchronously determined to be offline and that after
/// `in_blocks` the given change should be applied. The given block number
/// indicates the median last finalized block number and it should be used
/// as the canon block when starting the new grandpa voter.
///
/// No change should be signaled while any change is pending. Returns
/// an error if a change is already pending.
Schedule a change in the authorities.
The change will be applied at the end of execution of the block
`in_blocks` after the current block. This value may be 0, in which
case the change is applied at the end of the current block.

If the `forced` parameter is defined, this indicates that the current
set has been synchronously determined to be offline and that after
`in_blocks` the given change should be applied. The given block number
indicates the median last finalized block number and it should be used
as the canon block when starting the new grandpa voter.

No change should be signaled while any change is pending. Returns
an error if a change is already pending.
Schedule a change in the authorities . The change will be applied at the end of execution of the block ` in_blocks ` after the current block . This value may be 0 in which case the change is applied at the end of the current block . If the ` forced ` parameter is defined this indicates that the current set has been synchronously determined to be offline and that after ` in_blocks ` the given change should be applied . The given block number indicates the median last finalized block number and it should be used as the canon block when starting the new grandpa voter . No change should be signaled while any change is pending . Returns an error if a change is already pending .
pub fn schedule_change(
		next_authorities: Vec<(T::SessionKey, u64)>,
		in_blocks: T::BlockNumber,
		forced: Option<T::BlockNumber>,
	) -> Result {
		use primitives::traits::As;
		if Self::pending_change().is_none() {
			let scheduled_at = system::ChainContext::<T>::default().current_height();
			if let Some(_) = forced {
				if Self::next_forced().map_or(false, |next| next > scheduled_at) {
					return Err("Cannot signal forced change so soon after last.");
				}
				// only allow the next forced change when twice the window has passed since
				// this one.
				<NextForced<T>>::put(scheduled_at + in_blocks * T::BlockNumber::sa(2));
			}
			<PendingChange<T>>::put(StoredPendingChange {
				delay: in_blocks,
				scheduled_at,
				next_authorities,
				forced,
			});
			Ok(())
		} else {
			Err("Attempt to signal GRANDPA change with one already pending.")
		}
	}
pub fn schedule_change ( next_authorities : Vec < ( T :: SessionKey , u64 ) > , in_blocks : T :: BlockNumber , forced : Option < T :: BlockNumber > , ) -> Result { use primitives :: traits :: As ; if Self :: pending_change ( ) . is_none ( ) { let scheduled_at = system :: ChainContext :: < T > :: default ( ) . current_height ( ) ; if let Some ( _ ) = forced { if Self :: next_forced ( ) . map_or ( false , | next | next > scheduled_at ) { return Err ( " " ) ; } // only allow the next forced change when twice the window has passed since // this one. < NextForced < T > > :: put ( scheduled_at + in_blocks * T :: BlockNumber :: sa ( 2 ) ) ; } < PendingChange < T > > :: put ( StoredPendingChange { delay : in_blocks , scheduled_at , next_authorities , forced , } ) ; Ok ( ( ) ) } else { Err ( " " ) } }
Schedule a change in the authorities.
Schedule a change in the authorities .
next_authorities
Vec<(T::SessionKey, u64)>
in_blocks
T::BlockNumber
forced
Option<T::BlockNumber>
next_authorities
Vec<(T::SessionKey, u64)>
in_blocks
T::BlockNumber
forced
Option<T::BlockNumber>