/// Create a new voting round.
Create a new voting round.
Create a new voting round .
pub(super) fn new(
		round_number: u64,
		voters: VoterSet<E::Id>,
		base: (H, N),
		last_round_state: Option<crate::bridge_state::LatterView<H, N>>,
		finalized_sender: UnboundedSender<FinalizedNotification<H, N, E>>,
		env: Arc<E>,
	) -> VotingRound<H, N, E> {
		let round_data = env.round_data(round_number);
		let round_params = crate::round::RoundParams { voters, base, round_number };
		let votes = Round::new(round_params);
		let voting = if round_data.voter_id.as_ref() == Some(votes.primary_voter().0) {
			Voting::Primary
		} else if round_data.voter_id.as_ref().map_or(false, |id| votes.voters().contains(id)) {
			Voting::Yes
		} else {
			Voting::No
		};
		VotingRound {
			votes,
			voting,
			incoming: round_data.incoming,
			outgoing: Buffered::new(round_data.outgoing),
			state: Some(State::Start(round_data.prevote_timer, round_data.precommit_timer)),
			bridged_round_state: None,
			primary_block: None,
			best_finalized: None,
			env,
			last_round_state,
			finalized_sender,
		}
	}
pub ( super ) fn new ( round_number : u64 , voters : VoterSet < E :: Id > , base : ( H , N ) , last_round_state : Option < crate :: bridge_state :: LatterView < H , N > > , finalized_sender : UnboundedSender < FinalizedNotification < H , N , E > > , env : Arc < E > , ) -> VotingRound < H , N , E > { let round_data = env . round_data ( round_number ) ; let round_params = crate :: round :: RoundParams { voters , base , round_number } ; let votes = Round :: new ( round_params ) ; let voting = if round_data . voter_id . as_ref ( ) == Some ( votes . primary_voter ( ) . 0 ) { Voting :: Primary } else if round_data . voter_id . as_ref ( ) . map_or ( false , | id | votes . voters ( ) . contains ( id ) ) { Voting :: Yes } else { Voting :: No } ; VotingRound { votes , voting , incoming : round_data . incoming , outgoing : Buffered :: new ( round_data . outgoing ) , state : Some ( State :: Start ( round_data . prevote_timer , round_data . precommit_timer ) ) , bridged_round_state : None , primary_block : None , best_finalized : None , env , last_round_state , finalized_sender , } }
Create a new voting round.
Create a new voting round .
round_number
u64
voters
VoterSet<E::Id>
base
(H, N)
last_round_state
Option<crate::bridge_state::LatterView<H, N>>
finalized_sender
UnboundedSender<FinalizedNotification<H, N, E>>
env
Arc<E>