fn end_block(now: T::BlockNumber) -> Result {
		while let Some((proposal, proposal_hash)) = Self::take_proposal_if_expiring_at(now) {
			let tally = Self::take_tally(&proposal_hash);
			// If the proposal is to kill an already existing referendum `ref_index`.
			if let Some(&democracy::Call::cancel_referendum(ref_index)) = IsSubType::<democracy::Module<T>>::is_aux_sub_type(&proposal) {
				Self::deposit_event(RawEvent::TallyCancellation(proposal_hash, tally.0, tally.1, tally.2));
				// must have no nay and no abstains
				if let (_, 0, 0) = tally {
					<democracy::Module<T>>::internal_cancel_referendum(ref_index.into());
				}
			} else {
				Self::deposit_event(RawEvent::TallyReferendum(proposal_hash.clone(), tally.0, tally.1, tally.2));
				// More yay than nay and abstain. Will be enacted either immediately or with a delay
				if tally.0 > tally.1 + tally.2 {
					Self::kill_veto_of(&proposal_hash);
					// If there were no nay-votes from the council, then it's weakly uncontroversial; we enact immediately.
					let period = match tally.1 {
						0 => Zero::zero(),
						_ => Self::enact_delay_period(),
					};
					// If all council members voted yes, then it's strongly uncontroversial; we require a negative
					// super-majority at referendum in order to defeat it.
					let threshold = match tally {
						(_, 0, 0) => democracy::VoteThreshold::SuperMajorityAgainst,
						_ => democracy::VoteThreshold::SimpleMajority,
					};
					<democracy::Module<T>>::internal_start_referendum(proposal, threshold, period).map(|_| ())?;
				}
			}
		}
		Ok(())
	}
/// Checks for the end of the voting period at the end of each block.
///
/// Might end up:
///
///   - cancelling a referendum, or
///   - enacting immediately or with a delay,
///
/// based on the votes and the type of the proposal.
Checks for the end of the voting period at the end of each block.
Might end up.

cancelling a referendum, or
enacting immediately or with a delay.

based on the votes and the type of the proposal.
Checks for the end of the voting period at the end of each block . Might end up . cancelling a referendum or enacting immediately or with a delay . based on the votes and the type of the proposal .
fn end_block(now: T::BlockNumber) -> Result {
		while let Some((proposal, proposal_hash)) = Self::take_proposal_if_expiring_at(now) {
			let tally = Self::take_tally(&proposal_hash);
			// If the proposal is to kill an already existing referendum `ref_index`.
			if let Some(&democracy::Call::cancel_referendum(ref_index)) = IsSubType::<democracy::Module<T>>::is_aux_sub_type(&proposal) {
				Self::deposit_event(RawEvent::TallyCancellation(proposal_hash, tally.0, tally.1, tally.2));
				// must have no nay and no abstains
				if let (_, 0, 0) = tally {
					<democracy::Module<T>>::internal_cancel_referendum(ref_index.into());
				}
			} else {
				Self::deposit_event(RawEvent::TallyReferendum(proposal_hash.clone(), tally.0, tally.1, tally.2));
				// More yay than nay and abstain. Will be enacted either immediately or with a delay
				if tally.0 > tally.1 + tally.2 {
					Self::kill_veto_of(&proposal_hash);
					// If there were no nay-votes from the council, then it's weakly uncontroversial; we enact immediately.
					let period = match tally.1 {
						0 => Zero::zero(),
						_ => Self::enact_delay_period(),
					};
					// If all council members voted yes, then it's strongly uncontroversial; we require a negative
					// super-majority at referendum in order to defeat it.
					let threshold = match tally {
						(_, 0, 0) => democracy::VoteThreshold::SuperMajorityAgainst,
						_ => democracy::VoteThreshold::SimpleMajority,
					};
					<democracy::Module<T>>::internal_start_referendum(proposal, threshold, period).map(|_| ())?;
				}
			}
		}
		Ok(())
	}
fn end_block ( now : T :: BlockNumber ) -> Result { while let Some ( ( proposal , proposal_hash ) ) = Self :: take_proposal_if_expiring_at ( now ) { let tally = Self :: take_tally ( & proposal_hash ) ; // If the proposal is to kill an already existing referendum `ref_index`. if let Some ( & democracy :: Call :: cancel_referendum ( ref_index ) ) = IsSubType :: < democracy :: Module < T > > :: is_aux_sub_type ( & proposal ) { Self :: deposit_event ( RawEvent :: TallyCancellation ( proposal_hash , tally . 0 , tally . 1 , tally . 2 ) ) ; // must have no nay and no abstains if let ( _ , 0 , 0 ) = tally { < democracy :: Module < T > > :: internal_cancel_referendum ( ref_index . into ( ) ) ; } } else { Self :: deposit_event ( RawEvent :: TallyReferendum ( proposal_hash . clone ( ) , tally . 0 , tally . 1 , tally . 2 ) ) ; // More yay than nay and abstain. Will be enacted either immediately or with a delay if tally . 0 > tally . 1 + tally . 2 { Self :: kill_veto_of ( & proposal_hash ) ; // If there were no nay-votes from the council, then it's weakly uncontroversial; we enact immediately. let period = match tally . 1 { 0 => Zero :: zero ( ) , _ => Self :: enact_delay_period ( ) , } ; // If all council members voted yes, then it's strongly uncontroversial; we require a negative // super-majority at referendum in order to defeat it. let threshold = match tally { ( _ , 0 , 0 ) => democracy :: VoteThreshold :: SuperMajorityAgainst , _ => democracy :: VoteThreshold :: SimpleMajority , } ; < democracy :: Module < T > > :: internal_start_referendum ( proposal , threshold , period ) . map ( | _ | ( ) ) ? ; } } } Ok ( ( ) ) }
Checks for the end of the voting period at the end of each block.
Checks for the end of the voting period at the end of each block .
now
T::BlockNumber
now
T::BlockNumber