pub struct DagConsensus { /* private fields */ }Expand description
DAG-based consensus engine
Implementations§
Source§impl DagConsensus
impl DagConsensus
Sourcepub fn submit_transaction(
&self,
tx_type: TransactionType,
data: Vec<u8>,
) -> Result<String>
pub fn submit_transaction( &self, tx_type: TransactionType, data: Vec<u8>, ) -> Result<String>
Submit a transaction to the consensus system
Sourcepub fn create_vertex(&self) -> Result<Option<DagVertex>>
pub fn create_vertex(&self) -> Result<Option<DagVertex>>
Create a new vertex for pending transactions
Sourcepub fn add_vertex(&self, vertex: DagVertex) -> Result<()>
pub fn add_vertex(&self, vertex: DagVertex) -> Result<()>
Add a vertex from another node
Sourcepub fn is_finalized(&self, vertex_id: &str) -> bool
pub fn is_finalized(&self, vertex_id: &str) -> bool
Check if a vertex is finalized
Sourcepub fn finalize_vertices(&self) -> Result<Vec<String>>
pub fn finalize_vertices(&self) -> Result<Vec<String>>
Finalize vertices using the wave algorithm
Sourcepub fn get_finalized_order(&self) -> Vec<Transaction>
pub fn get_finalized_order(&self) -> Vec<Transaction>
Get the total order of finalized transactions
Sourcepub fn detect_conflicts(&self, tx1: &Transaction, tx2: &Transaction) -> bool
pub fn detect_conflicts(&self, tx1: &Transaction, tx2: &Transaction) -> bool
Detect conflicts between transactions
Sourcepub fn get_stats(&self) -> ConsensusStats
pub fn get_stats(&self) -> ConsensusStats
Get consensus statistics
Sourcepub fn prune_old_vertices(&self, keep_count: usize)
pub fn prune_old_vertices(&self, keep_count: usize)
Prune old finalized vertices to save memory
Auto Trait Implementations§
impl Freeze for DagConsensus
impl !RefUnwindSafe for DagConsensus
impl Send for DagConsensus
impl Sync for DagConsensus
impl Unpin for DagConsensus
impl !UnwindSafe for DagConsensus
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