Struct snarkos_node_consensus::Consensus
source · pub struct Consensus<N: Network> { /* private fields */ }
Implementations§
source§impl<N: Network> Consensus<N>
impl<N: Network> Consensus<N>
sourcepub fn new(
account: Account<N>,
ledger: Arc<dyn LedgerService<N>>,
ip: Option<SocketAddr>,
trusted_validators: &[SocketAddr],
storage_mode: StorageMode,
) -> Result<Self>
pub fn new( account: Account<N>, ledger: Arc<dyn LedgerService<N>>, ip: Option<SocketAddr>, trusted_validators: &[SocketAddr], storage_mode: StorageMode, ) -> Result<Self>
Initializes a new instance of consensus.
sourcepub async fn run(
&mut self,
primary_sender: PrimarySender<N>,
primary_receiver: PrimaryReceiver<N>,
) -> Result<()>
pub async fn run( &mut self, primary_sender: PrimarySender<N>, primary_receiver: PrimaryReceiver<N>, ) -> Result<()>
Run the consensus instance.
sourcepub const fn ledger(&self) -> &Arc<dyn LedgerService<N>>
pub const fn ledger(&self) -> &Arc<dyn LedgerService<N>>
Returns the ledger.
sourcepub fn primary_sender(&self) -> &PrimarySender<N>
pub fn primary_sender(&self) -> &PrimarySender<N>
Returns the primary sender.
source§impl<N: Network> Consensus<N>
impl<N: Network> Consensus<N>
sourcepub fn num_unconfirmed_transmissions(&self) -> usize
pub fn num_unconfirmed_transmissions(&self) -> usize
Returns the number of unconfirmed transmissions.
sourcepub fn num_unconfirmed_ratifications(&self) -> usize
pub fn num_unconfirmed_ratifications(&self) -> usize
Returns the number of unconfirmed ratifications.
sourcepub fn num_unconfirmed_solutions(&self) -> usize
pub fn num_unconfirmed_solutions(&self) -> usize
Returns the number of solutions.
sourcepub fn num_unconfirmed_transactions(&self) -> usize
pub fn num_unconfirmed_transactions(&self) -> usize
Returns the number of unconfirmed transactions.
source§impl<N: Network> Consensus<N>
impl<N: Network> Consensus<N>
sourcepub fn unconfirmed_transmission_ids(
&self,
) -> impl '_ + Iterator<Item = TransmissionID<N>>
pub fn unconfirmed_transmission_ids( &self, ) -> impl '_ + Iterator<Item = TransmissionID<N>>
Returns the unconfirmed transmission IDs.
sourcepub fn unconfirmed_transmissions(
&self,
) -> impl '_ + Iterator<Item = (TransmissionID<N>, Transmission<N>)>
pub fn unconfirmed_transmissions( &self, ) -> impl '_ + Iterator<Item = (TransmissionID<N>, Transmission<N>)>
Returns the unconfirmed transmissions.
sourcepub fn unconfirmed_solutions(
&self,
) -> impl '_ + Iterator<Item = (SolutionID<N>, Data<Solution<N>>)>
pub fn unconfirmed_solutions( &self, ) -> impl '_ + Iterator<Item = (SolutionID<N>, Data<Solution<N>>)>
Returns the unconfirmed solutions.
sourcepub fn unconfirmed_transactions(
&self,
) -> impl '_ + Iterator<Item = (N::TransactionID, Data<Transaction<N>>)>
pub fn unconfirmed_transactions( &self, ) -> impl '_ + Iterator<Item = (N::TransactionID, Data<Transaction<N>>)>
Returns the unconfirmed transactions.
source§impl<N: Network> Consensus<N>
impl<N: Network> Consensus<N>
sourcepub fn worker_transmission_ids(
&self,
) -> impl '_ + Iterator<Item = TransmissionID<N>>
pub fn worker_transmission_ids( &self, ) -> impl '_ + Iterator<Item = TransmissionID<N>>
Returns the worker transmission IDs.
sourcepub fn worker_transmissions(
&self,
) -> impl '_ + Iterator<Item = (TransmissionID<N>, Transmission<N>)>
pub fn worker_transmissions( &self, ) -> impl '_ + Iterator<Item = (TransmissionID<N>, Transmission<N>)>
Returns the worker transmissions.
sourcepub fn worker_solutions(
&self,
) -> impl '_ + Iterator<Item = (SolutionID<N>, Data<Solution<N>>)>
pub fn worker_solutions( &self, ) -> impl '_ + Iterator<Item = (SolutionID<N>, Data<Solution<N>>)>
Returns the worker solutions.
sourcepub fn worker_transactions(
&self,
) -> impl '_ + Iterator<Item = (N::TransactionID, Data<Transaction<N>>)>
pub fn worker_transactions( &self, ) -> impl '_ + Iterator<Item = (N::TransactionID, Data<Transaction<N>>)>
Returns the worker transactions.
source§impl<N: Network> Consensus<N>
impl<N: Network> Consensus<N>
sourcepub fn inbound_transmission_ids(
&self,
) -> impl '_ + Iterator<Item = TransmissionID<N>>
pub fn inbound_transmission_ids( &self, ) -> impl '_ + Iterator<Item = TransmissionID<N>>
Returns the transmission IDs in the inbound queue.
sourcepub fn inbound_transmissions(
&self,
) -> impl '_ + Iterator<Item = (TransmissionID<N>, Transmission<N>)>
pub fn inbound_transmissions( &self, ) -> impl '_ + Iterator<Item = (TransmissionID<N>, Transmission<N>)>
Returns the transmissions in the inbound queue.
sourcepub fn inbound_solutions(
&self,
) -> impl '_ + Iterator<Item = (SolutionID<N>, Data<Solution<N>>)>
pub fn inbound_solutions( &self, ) -> impl '_ + Iterator<Item = (SolutionID<N>, Data<Solution<N>>)>
Returns the solutions in the inbound queue.
sourcepub fn inbound_transactions(
&self,
) -> impl '_ + Iterator<Item = (N::TransactionID, Data<Transaction<N>>)>
pub fn inbound_transactions( &self, ) -> impl '_ + Iterator<Item = (N::TransactionID, Data<Transaction<N>>)>
Returns the transactions in the inbound queue.
source§impl<N: Network> Consensus<N>
impl<N: Network> Consensus<N>
sourcepub async fn add_unconfirmed_solution(
&self,
solution: Solution<N>,
) -> Result<()>
pub async fn add_unconfirmed_solution( &self, solution: Solution<N>, ) -> Result<()>
Adds the given unconfirmed solution to the memory pool.
sourcepub async fn add_unconfirmed_transaction(
&self,
transaction: Transaction<N>,
) -> Result<()>
pub async fn add_unconfirmed_transaction( &self, transaction: Transaction<N>, ) -> Result<()>
Adds the given unconfirmed transaction to the memory pool.
Trait Implementations§
Auto Trait Implementations§
impl<N> Freeze for Consensus<N>where
<N as Environment>::Field: Freeze,
<N as Environment>::Scalar: Freeze,
<N as Environment>::Projective: Freeze,
impl<N> !RefUnwindSafe for Consensus<N>
impl<N> Send for Consensus<N>
impl<N> Sync for Consensus<N>
impl<N> Unpin for Consensus<N>where
<N as Environment>::Field: Unpin,
<N as Environment>::Scalar: Unpin,
<N as Environment>::Projective: Unpin,
impl<N> !UnwindSafe for Consensus<N>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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>
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>
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