pub enum Observation<T: NetworkEvent, P: PublicId> {
Genesis {
group: BTreeSet<P>,
related_info: Vec<u8>,
},
Add {
peer_id: P,
related_info: Vec<u8>,
},
Remove {
peer_id: P,
related_info: Vec<u8>,
},
Accusation {
offender: P,
malice: Malice<T, P>,
},
OpaquePayload(T),
StartDkg(BTreeSet<P>),
DkgResult {
participants: BTreeSet<P>,
dkg_result: DkgResultWrapper,
},
DkgMessage(DkgMessage),
}
Expand description
An enum of the various network events for which a peer can vote.
Variants§
Genesis
Genesis group
Fields
Extra arbitrary information for use by the client.
Note: this can be set through the genesis_related_info
argument of
Parsec::from_genesis
.
Add
Vote to add the indicated peer to the network.
Fields
peer_id: P
Public id of the peer to be added
Extra arbitrary information for use by the client
Remove
Vote to remove the indicated peer from the network.
Fields
peer_id: P
Public id of the peer to be removed
Extra arbitrary information for use by the client
Accusation
Output only: Do not vote for it. Vote to accuse a peer of malicious behaviour.
Fields
offender: P
Public id of the peer committing the malice.
OpaquePayload(T)
Vote for an event which is opaque to Parsec.
StartDkg(BTreeSet<P>)
Internal only: No blocks with it. Can be voted as an input.
DkgResult
Output only: Do not vote for it. Will have empty proof set.
Fields
dkg_result: DkgResultWrapper
DKG result. public_key_set will be shared state. secret_key_share will be unique to each peers: all participating peers will have one assuming less than 1/3 malicious. (Ignored in comparaison and serialization).
DkgMessage(DkgMessage)
Internal only: Do not vote for it or expect it to come in blocks. Vote for the next message (Part or Ack) to be handled for the Distributed Key Generation algorithm used by our common coin.
Implementations§
Source§impl<T: NetworkEvent, P: PublicId> Observation<T, P>
impl<T: NetworkEvent, P: PublicId> Observation<T, P>
Sourcepub fn is_dkg_message(&self) -> bool
pub fn is_dkg_message(&self) -> bool
Is this observation an internal DkgMessage
Sourcepub fn is_internal(&self) -> bool
pub fn is_internal(&self) -> bool
Is this observation an internal and should not be published in a Block
Sourcepub fn is_dkg_result(&self) -> bool
pub fn is_dkg_result(&self) -> bool
Is this observation a result only DkgResult
Trait Implementations§
Source§impl<T: Clone + NetworkEvent, P: Clone + PublicId> Clone for Observation<T, P>
impl<T: Clone + NetworkEvent, P: Clone + PublicId> Clone for Observation<T, P>
Source§fn clone(&self) -> Observation<T, P>
fn clone(&self) -> Observation<T, P>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more