pub struct BFT<N: Network> { /* private fields */ }Implementations§
Source§impl<N: Network> BFT<N>
impl<N: Network> BFT<N>
Sourcepub fn new(
account: Account<N>,
storage: Storage<N>,
ledger: Arc<dyn LedgerService<N>>,
block_sync: Arc<BlockSync<N>>,
ip: Option<SocketAddr>,
trusted_validators: &[SocketAddr],
trusted_peers_only: bool,
node_data_dir: NodeDataDir,
dev: Option<u16>,
) -> Result<Self>
pub fn new( account: Account<N>, storage: Storage<N>, ledger: Arc<dyn LedgerService<N>>, block_sync: Arc<BlockSync<N>>, ip: Option<SocketAddr>, trusted_validators: &[SocketAddr], trusted_peers_only: bool, node_data_dir: NodeDataDir, dev: Option<u16>, ) -> Result<Self>
Initializes a new instance of the BFT.
Sourcepub async fn run(
&mut self,
ping: Option<Arc<Ping<N>>>,
consensus_sender: Option<ConsensusSender<N>>,
primary_sender: PrimarySender<N>,
primary_receiver: PrimaryReceiver<N>,
) -> Result<()>
pub async fn run( &mut self, ping: Option<Arc<Ping<N>>>, consensus_sender: Option<ConsensusSender<N>>, primary_sender: PrimarySender<N>, primary_receiver: PrimaryReceiver<N>, ) -> Result<()>
Run the BFT instance.
This will return as soon as all required tasks are spawned. The function must not be called more than once per instance.
Sourcepub fn ledger(&self) -> &Arc<dyn LedgerService<N>> ⓘ
pub fn ledger(&self) -> &Arc<dyn LedgerService<N>> ⓘ
Returns the ledger.
Sourcepub fn leader(&self) -> Option<Address<N>>
pub fn leader(&self) -> Option<Address<N>>
Returns the leader of the current even round, if one was present.
Sourcepub const fn leader_certificate(
&self,
) -> &Arc<RwLock<Option<BatchCertificate<N>>>> ⓘ
pub const fn leader_certificate( &self, ) -> &Arc<RwLock<Option<BatchCertificate<N>>>> ⓘ
Returns the certificate of the leader from the current even round, if one was present.
Source§impl<N: Network> BFT<N>
impl<N: Network> BFT<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> BFT<N>
impl<N: Network> BFT<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.
Trait Implementations§
Source§impl<N: Network> PrimaryCallback<N> for BFT<N>
impl<N: Network> PrimaryCallback<N> for BFT<N>
Source§fn update_to_next_round(&self, current_round: u64) -> bool
fn update_to_next_round(&self, current_round: u64) -> bool
Notification that a new round has started.
Source§fn add_new_certificate<'life0, 'async_trait>(
&'life0 self,
certificate: BatchCertificate<N>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_new_certificate<'life0, 'async_trait>(
&'life0 self,
certificate: BatchCertificate<N>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Notification about a new certificated generated by Primary or received by the Primary from a peer.
Source§impl<N: Network> SyncCallback<N> for BFT<N>
impl<N: Network> SyncCallback<N> for BFT<N>
Source§fn sync_dag_at_bootup<'life0, 'async_trait>(
&'life0 self,
certificates: Vec<BatchCertificate<N>>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn sync_dag_at_bootup<'life0, 'async_trait>(
&'life0 self,
certificates: Vec<BatchCertificate<N>>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Syncs the BFT DAG with the given batch certificates. These batch certificates must already exist in the ledger.
This method commits all the certificates into the DAG. Note that there is no need to insert the certificates into the DAG, because these certificates already exist in the ledger and therefore do not need to be re-ordered into future committed subdags.
Source§fn add_new_certificate<'life0, 'async_trait>(
&'life0 self,
certificate: BatchCertificate<N>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_new_certificate<'life0, 'async_trait>(
&'life0 self,
certificate: BatchCertificate<N>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Notification about a new certificate detected by the Sync instance after fetching a new block.
Auto Trait Implementations§
impl<N> Freeze for BFT<N>
impl<N> !RefUnwindSafe for BFT<N>
impl<N> Send for BFT<N>
impl<N> Sync for BFT<N>
impl<N> Unpin for BFT<N>
impl<N> UnsafeUnpin for BFT<N>
impl<N> !UnwindSafe for BFT<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§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