Struct snarkvm_ledger_committee::Committee
source · pub struct Committee<N: Network> { /* private fields */ }
Implementations§
source§impl<N: Network> Committee<N>
impl<N: Network> Committee<N>
sourcepub const MAX_COMMITTEE_SIZE: u16 = 200u16
pub const MAX_COMMITTEE_SIZE: u16 = 200u16
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)>
pub const fn members(&self) -> &IndexMap<Address<N>, (u64, bool)>
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 (2f + 1)
.
sourcepub const fn total_stake(&self) -> u64
pub const fn total_stake(&self) -> u64
Returns the total amount of stake in the committee (3f + 1)
.
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.
source§impl<N: PartialEq + Network> PartialEq for Committee<N>
impl<N: PartialEq + Network> PartialEq for Committee<N>
impl<N: Eq + Network> Eq for Committee<N>
impl<N: Network> StructuralEq for Committee<N>
impl<N: Network> StructuralPartialEq for Committee<N>
Auto Trait Implementations§
impl<N> RefUnwindSafe for Committee<N>where <N as Environment>::Projective: RefUnwindSafe,
impl<N> Send for Committee<N>
impl<N> Sync for Committee<N>
impl<N> Unpin for Committee<N>where <N as Environment>::Projective: Unpin,
impl<N> UnwindSafe for Committee<N>where <N as Environment>::Projective: UnwindSafe,
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
§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>,
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.