[−][src]Struct hbbft::NetworkInfo
Common data shared between algorithms: the nodes' IDs and key shares.
Methods
impl<N: NodeIdT> NetworkInfo<N>
[src]
pub fn new<SKS: Into<Option<SecretKeyShare>>>(
our_id: N,
secret_key_share: SKS,
public_key_set: PublicKeySet,
secret_key: SecretKey,
public_keys: BTreeMap<N, PublicKey>
) -> Self
[src]
our_id: N,
secret_key_share: SKS,
public_key_set: PublicKeySet,
secret_key: SecretKey,
public_keys: BTreeMap<N, PublicKey>
) -> Self
Creates a new NetworkInfo
with the given ID and keys.
All nodes in the network must share the same public information. Validators' IDs must be
keys in the public_keys
map, and their secret key share must match their share in the
public_key_set
.
Panics
Panics if public_keys
is empty.
pub fn our_id(&self) -> &N
[src]
The ID of the node the algorithm runs on.
pub fn all_ids(&self) -> impl Iterator<Item = &N>
[src]
ID of all nodes in the network.
pub fn num_nodes(&self) -> usize
[src]
The total number N of nodes.
pub fn num_faulty(&self) -> usize
[src]
The maximum number f of faulty, Byzantine nodes up to which Honey Badger is guaranteed to be correct.
pub fn num_correct(&self) -> usize
[src]
The minimum number N - f of correct nodes with which Honey Badger is guaranteed to be correct.
pub fn secret_key_share(&self) -> Option<&SecretKeyShare>
[src]
Returns our secret key share for threshold cryptography, or None
if not a validator.
pub fn secret_key(&self) -> &SecretKey
[src]
Returns our secret key for encryption and signing.
pub fn public_key_set(&self) -> &PublicKeySet
[src]
Returns the public key set for threshold cryptography.
pub fn public_key_share(&self, id: &N) -> Option<&PublicKeyShare>
[src]
Returns the public key share if a node with that ID exists, otherwise None
.
pub fn public_key_share_map(&self) -> &BTreeMap<N, PublicKeyShare>
[src]
Returns a map of all node IDs to their public key shares.
pub fn public_key(&self, id: &N) -> Option<&PublicKey>
[src]
Returns a map of all node IDs to their public keys.
pub fn public_key_map(&self) -> &BTreeMap<N, PublicKey>
[src]
Returns a map of all node IDs to their public keys.
pub fn node_index(&self, id: &N) -> Option<usize>
[src]
The index of a node in a canonical numbering of all nodes. This is the index where the
node appears in all_ids
.
pub fn is_validator(&self) -> bool
[src]
Returns true
if this node takes part in the consensus itself. If not, it is only an
observer.
pub fn is_node_validator(&self, id: &N) -> bool
[src]
Returns true
if the given node takes part in the consensus itself. If not, it is only an
observer.
pub fn generate_map<I, R>(
ids: I,
rng: &mut R
) -> Result<BTreeMap<N, NetworkInfo<N>>, Error> where
I: IntoIterator<Item = N>,
R: Rng,
[src]
ids: I,
rng: &mut R
) -> Result<BTreeMap<N, NetworkInfo<N>>, Error> where
I: IntoIterator<Item = N>,
R: Rng,
Generates a map of matching NetworkInfo
s for testing.
Trait Implementations
impl<N: Clone> Clone for NetworkInfo<N>
[src]
fn clone(&self) -> NetworkInfo<N>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<N: Debug> Debug for NetworkInfo<N>
[src]
Auto Trait Implementations
impl<N> Send for NetworkInfo<N> where
N: Send,
N: Send,
impl<N> Sync for NetworkInfo<N> where
N: Sync,
N: Sync,
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,