Type Alias hotshot_task_impls::vote_collection::DaVoteState
source · type DaVoteState<TYPES, V> = VoteCollectionTaskState<TYPES, DaVote2<TYPES>, DaCertificate2<TYPES>, V>;
Expand description
Alias for DA vote accumulator
Aliased Type§
struct DaVoteState<TYPES, V> {
pub public_key: <TYPES as NodeType>::SignatureKey,
pub membership: Arc<RwLock<<TYPES as NodeType>::Membership>>,
pub accumulator: Option<VoteAccumulator<TYPES, SimpleVote<TYPES, DaData2<TYPES>>, SimpleCertificate<TYPES, DaData2<TYPES>, SuccessThreshold>, V>>,
pub view: <TYPES as NodeType>::View,
pub epoch: <TYPES as NodeType>::Epoch,
pub id: u64,
pub transition_indicator: EpochTransitionIndicator,
}
Fields§
§public_key: <TYPES as NodeType>::SignatureKey
Public key for this node.
membership: Arc<RwLock<<TYPES as NodeType>::Membership>>
Membership for voting
accumulator: Option<VoteAccumulator<TYPES, SimpleVote<TYPES, DaData2<TYPES>>, SimpleCertificate<TYPES, DaData2<TYPES>, SuccessThreshold>, V>>
accumulator handles aggregating the votes
view: <TYPES as NodeType>::View
The view which we are collecting votes for
epoch: <TYPES as NodeType>::Epoch
The epoch which we are collecting votes for
id: u64
Node id
transition_indicator: EpochTransitionIndicator
Whether we should check if we are the leader when handling a vote
Implementations
source§impl<TYPES: NodeType, VOTE: Vote<TYPES> + AggregatableVote<TYPES, VOTE, CERT>, CERT: Certificate<TYPES, VOTE::Commitment, Voteable = VOTE::Commitment> + Clone + Debug, V: Versions> VoteCollectionTaskState<TYPES, VOTE, CERT, V>
impl<TYPES: NodeType, VOTE: Vote<TYPES> + AggregatableVote<TYPES, VOTE, CERT>, CERT: Certificate<TYPES, VOTE::Commitment, Voteable = VOTE::Commitment> + Clone + Debug, V: Versions> VoteCollectionTaskState<TYPES, VOTE, CERT, V>
sourcepub async fn accumulate_vote(
&mut self,
vote: &VOTE,
sender_epoch: TYPES::Epoch,
event_stream: &Sender<Arc<HotShotEvent<TYPES>>>,
) -> Result<Option<CERT>>
pub async fn accumulate_vote( &mut self, vote: &VOTE, sender_epoch: TYPES::Epoch, event_stream: &Sender<Arc<HotShotEvent<TYPES>>>, ) -> Result<Option<CERT>>
Take one vote and accumulate it. Returns either the cert or the updated state after the vote is accumulated
§Errors
If are unable to accumulate the vote
Trait Implementations
source§impl<TYPES: NodeType, V: Versions> HandleVoteEvent<TYPES, SimpleVote<TYPES, DaData2<TYPES>>, SimpleCertificate<TYPES, DaData2<TYPES>, SuccessThreshold>> for VoteCollectionTaskState<TYPES, DaVote2<TYPES>, DaCertificate2<TYPES>, V>
impl<TYPES: NodeType, V: Versions> HandleVoteEvent<TYPES, SimpleVote<TYPES, DaData2<TYPES>>, SimpleCertificate<TYPES, DaData2<TYPES>, SuccessThreshold>> for VoteCollectionTaskState<TYPES, DaVote2<TYPES>, DaCertificate2<TYPES>, V>
source§fn handle_vote_event<'life0, 'life1, 'async_trait>(
&'life0 mut self,
event: Arc<HotShotEvent<TYPES>>,
sender: &'life1 Sender<Arc<HotShotEvent<TYPES>>>,
) -> Pin<Box<dyn Future<Output = Result<Option<DaCertificate2<TYPES>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_vote_event<'life0, 'life1, 'async_trait>(
&'life0 mut self,
event: Arc<HotShotEvent<TYPES>>,
sender: &'life1 Sender<Arc<HotShotEvent<TYPES>>>,
) -> Pin<Box<dyn Future<Output = Result<Option<DaCertificate2<TYPES>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handle a vote event Read more