pub struct Proposal<N: Network> { /* private fields */ }Implementations§
Source§impl<N: Network> Proposal<N>
impl<N: Network> Proposal<N>
Sourcepub fn new(
committee: Committee<N>,
batch_header: BatchHeader<N>,
transmissions: IndexMap<TransmissionID<N>, Transmission<N>>,
) -> Result<Self>
pub fn new( committee: Committee<N>, batch_header: BatchHeader<N>, transmissions: IndexMap<TransmissionID<N>, Transmission<N>>, ) -> Result<Self>
Initializes a new instance of the proposal.
Sourcepub const fn batch_header(&self) -> &BatchHeader<N>
pub const fn batch_header(&self) -> &BatchHeader<N>
Returns the proposed batch header.
Sourcepub const fn transmissions(
&self,
) -> &IndexMap<TransmissionID<N>, Transmission<N>>
pub const fn transmissions( &self, ) -> &IndexMap<TransmissionID<N>, Transmission<N>>
Returns the transmissions.
Sourcepub fn into_transmissions(self) -> IndexMap<TransmissionID<N>, Transmission<N>>
pub fn into_transmissions(self) -> IndexMap<TransmissionID<N>, Transmission<N>>
Returns the transmissions.
Sourcepub fn nonsigners(&self, committee: &Committee<N>) -> HashSet<Address<N>>
pub fn nonsigners(&self, committee: &Committee<N>) -> HashSet<Address<N>>
Returns the nonsigners.
Sourcepub fn is_quorum_threshold_reached(&self, committee: &Committee<N>) -> bool
pub fn is_quorum_threshold_reached(&self, committee: &Committee<N>) -> bool
Returns true if the quorum threshold has been reached for the proposed batch.
Sourcepub fn contains_transmission(
&self,
transmission_id: impl Into<TransmissionID<N>>,
) -> bool
pub fn contains_transmission( &self, transmission_id: impl Into<TransmissionID<N>>, ) -> bool
Returns true if the proposal contains the given transmission ID.
Sourcepub fn get_transmission(
&self,
transmission_id: impl Into<TransmissionID<N>>,
) -> Option<&Transmission<N>>
pub fn get_transmission( &self, transmission_id: impl Into<TransmissionID<N>>, ) -> Option<&Transmission<N>>
Returns the transmission for the given transmission ID.
Sourcepub fn add_signature(
&mut self,
signer: Address<N>,
signature: Signature<N>,
committee: &Committee<N>,
) -> Result<()>
pub fn add_signature( &mut self, signer: Address<N>, signature: Signature<N>, committee: &Committee<N>, ) -> Result<()>
Adds a signature to the proposal, if the signature is valid.
Sourcepub fn to_certificate(
&self,
committee: &Committee<N>,
) -> Result<(BatchCertificate<N>, IndexMap<TransmissionID<N>, Transmission<N>>)>
pub fn to_certificate( &self, committee: &Committee<N>, ) -> Result<(BatchCertificate<N>, IndexMap<TransmissionID<N>, Transmission<N>>)>
Returns the batch certificate and transmissions.
Trait Implementations§
impl<N: Eq + Network> Eq for Proposal<N>
impl<N: Network> StructuralPartialEq for Proposal<N>
Auto Trait Implementations§
impl<N> Freeze for Proposal<N>where
<N as Environment>::Field: Freeze,
<N as Environment>::Projective: Freeze,
<N as Environment>::Scalar: Freeze,
impl<N> RefUnwindSafe for Proposal<N>where
<N as Environment>::Field: RefUnwindSafe,
<N as Environment>::Projective: RefUnwindSafe,
<N as Environment>::Scalar: RefUnwindSafe,
<N as Network>::TransmissionChecksum: RefUnwindSafe,
<N as Network>::TransactionID: RefUnwindSafe,
N: RefUnwindSafe,
<N as Network>::BlockHash: RefUnwindSafe,
<N as Network>::StateRoot: RefUnwindSafe,
<N as Network>::TransitionID: RefUnwindSafe,
<<N as Environment>::PairingCurve as PairingEngine>::G1Affine: RefUnwindSafe,
impl<N> Send for Proposal<N>
impl<N> Sync for Proposal<N>
impl<N> Unpin for Proposal<N>where
<N as Environment>::Field: Unpin,
<N as Environment>::Projective: Unpin,
<N as Environment>::Scalar: Unpin,
<N as Network>::TransmissionChecksum: Unpin,
<N as Network>::TransactionID: Unpin,
N: Unpin,
<N as Network>::BlockHash: Unpin,
<N as Network>::StateRoot: Unpin,
<N as Network>::TransitionID: Unpin,
<<N as Environment>::PairingCurve as PairingEngine>::G1Affine: Unpin,
impl<N> UnwindSafe for Proposal<N>where
<N as Environment>::Field: UnwindSafe,
<N as Environment>::Projective: UnwindSafe,
<N as Environment>::Scalar: UnwindSafe,
<N as Network>::TransmissionChecksum: UnwindSafe,
<N as Network>::TransactionID: UnwindSafe,
N: UnwindSafe,
<N as Network>::BlockHash: UnwindSafe,
<N as Network>::StateRoot: UnwindSafe,
<N as Network>::TransitionID: UnwindSafe,
<<N as Environment>::PairingCurve as PairingEngine>::G1Affine: UnwindSafe + RefUnwindSafe,
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<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
Compare self to
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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