pub struct Committee<N: Network> { /* private fields */ }
Implementations§
Source§impl<N: Network> Committee<N>
impl<N: Network> Committee<N>
Sourcepub const COMMITTEE_LOOKBACK_RANGE: u64 = 100u64
pub const COMMITTEE_LOOKBACK_RANGE: u64 = 100u64
The committee lookback range.
Sourcepub const MAX_COMMITTEE_SIZE: u16 = BatchHeader<N>::MAX_CERTIFICATES
pub const MAX_COMMITTEE_SIZE: u16 = BatchHeader<N>::MAX_CERTIFICATES
The maximum number of members that may be in a committee.
Source§impl<N: Network> Committee<N>
impl<N: Network> Committee<N>
Sourcepub const fn starting_round(&self) -> u64
pub const fn starting_round(&self) -> u64
Returns the starting round number for this committee.
Sourcepub const fn members(&self) -> &IndexMap<Address<N>, (u64, bool, u8)>
pub const fn members(&self) -> &IndexMap<Address<N>, (u64, bool, u8)>
Returns the committee members alongside their stake.
Sourcepub fn num_members(&self) -> usize
pub fn num_members(&self) -> usize
Returns the number of validators in the committee.
Sourcepub fn is_committee_member(&self, address: Address<N>) -> bool
pub fn is_committee_member(&self, address: Address<N>) -> bool
Returns true
if the given address is in the committee.
Sourcepub fn is_committee_member_open(&self, address: Address<N>) -> bool
pub fn is_committee_member_open(&self, address: Address<N>) -> bool
Returns true
if the given address is in the committee and is open.
Sourcepub fn get_stake(&self, address: Address<N>) -> u64
pub fn get_stake(&self, address: Address<N>) -> u64
Returns the amount of stake for the given address.
Sourcepub fn is_availability_threshold_reached(
&self,
addresses: &HashSet<Address<N>>,
) -> bool
pub fn is_availability_threshold_reached( &self, addresses: &HashSet<Address<N>>, ) -> bool
Returns true
if the combined stake for the given addresses reaches the availability threshold.
This method takes in a HashSet
to guarantee that the given addresses are unique.
Sourcepub fn is_quorum_threshold_reached(
&self,
addresses: &HashSet<Address<N>>,
) -> bool
pub fn is_quorum_threshold_reached( &self, addresses: &HashSet<Address<N>>, ) -> bool
Returns true
if the combined stake for the given addresses reaches the quorum threshold.
This method takes in a HashSet
to guarantee that the given addresses are unique.
Sourcepub fn availability_threshold(&self) -> u64
pub fn availability_threshold(&self) -> u64
Returns the amount of stake required to reach the availability threshold (f + 1)
.
Sourcepub fn quorum_threshold(&self) -> u64
pub fn quorum_threshold(&self) -> u64
Returns the amount of stake required to reach a quorum threshold (N - f)
.
Sourcepub const fn total_stake(&self) -> u64
pub const fn total_stake(&self) -> u64
Returns the total amount of stake in the committee.
Trait Implementations§
Source§impl<'de, N: Network> Deserialize<'de> for Committee<N>
impl<'de, N: Network> Deserialize<'de> for Committee<N>
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserializes the committee from a JSON-string or buffer.
impl<N: Eq + Network> Eq for Committee<N>
impl<N: Network> StructuralPartialEq for Committee<N>
Auto Trait Implementations§
impl<N> Freeze for Committee<N>
impl<N> RefUnwindSafe for Committee<N>
impl<N> Send for Committee<N>
impl<N> Sync for Committee<N>
impl<N> Unpin for Committee<N>
impl<N> UnwindSafe for Committee<N>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
fn take_from_value<D>(
value: &mut Value,
field: &str,
) -> Result<T, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more