pub struct Group<C: Curve> {
pub nodes: Vec<Node<C>>,
pub threshold: usize,
}Expand description
A Group is a collection of Nodes with an associated threshold. A DKG scheme
takes in a group at the beginning of the protocol and outputs a potentially
new group that contains members that succesfully ran the protocol. When
creating a new group using the from() or from_list()method, the module
sets the threshold to the output of default_threshold().
Fields§
§nodes: Vec<Node<C>>The vector of nodes in the group
threshold: usizeThe minimum number of nodes required to participate in the DKG for this group
Implementations§
Source§impl<C> Group<C>where
C: Curve,
impl<C> Group<C>where
C: Curve,
Sourcepub fn from_list(nodes: Vec<Node<C>>) -> Group<C>
pub fn from_list(nodes: Vec<Node<C>>) -> Group<C>
Converts a vector of nodes to a group with the default threshold (51%)
Sourcepub fn new(nodes: Vec<Node<C>>, threshold: usize) -> DKGResult<Group<C>>
pub fn new(nodes: Vec<Node<C>>, threshold: usize) -> DKGResult<Group<C>>
Creates a new group from the provided vector of nodes and threshold.
Valid thresholds are >= 51% * nodes.len() and <= 100% * nodes.len()
Sourcepub fn index(&self, public: &C::Point) -> Option<Idx>
pub fn index(&self, public: &C::Point) -> Option<Idx>
Gets the index of the node corresponding to the provided public key
pub fn contains_index(&self, idx: Idx) -> bool
Trait Implementations§
Source§impl<'de, C: Curve> Deserialize<'de> for Group<C>where
C::Scalar: DeserializeOwned,
impl<'de, C: Curve> Deserialize<'de> for Group<C>where
C::Scalar: DeserializeOwned,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<C: Curve> StructuralPartialEq for Group<C>
Auto Trait Implementations§
impl<C> Freeze for Group<C>
impl<C> RefUnwindSafe for Group<C>
impl<C> Send for Group<C>
impl<C> Sync for Group<C>
impl<C> Unpin for Group<C>
impl<C> UnwindSafe for Group<C>
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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