pub struct ConsensusThread {Show 16 fields
pub mempool_lock: Arc<RwLock<Mempool>>,
pub blockchain_lock: Arc<RwLock<Blockchain>>,
pub wallet_lock: Arc<RwLock<Wallet>>,
pub generate_genesis_block: bool,
pub sender_to_router: Sender<RoutingEvent>,
pub sender_to_miner: Sender<MiningEvent>,
pub block_producing_timer: Timestamp,
pub timer: Timer,
pub network: Network,
pub storage: Storage,
pub stats: ConsensusStats,
pub txs_for_mempool: Vec<Transaction>,
pub stat_sender: Sender<String>,
pub config_lock: Arc<RwLock<dyn Configuration + Send + Sync>>,
pub produce_blocks_by_timer: bool,
pub delete_old_blocks: bool,
}
Expand description
Manages blockchain and the mempool
Fields§
§mempool_lock: Arc<RwLock<Mempool>>
§blockchain_lock: Arc<RwLock<Blockchain>>
§wallet_lock: Arc<RwLock<Wallet>>
§generate_genesis_block: bool
§sender_to_router: Sender<RoutingEvent>
§sender_to_miner: Sender<MiningEvent>
§block_producing_timer: Timestamp
§timer: Timer
§network: Network
§storage: Storage
§stats: ConsensusStats
§txs_for_mempool: Vec<Transaction>
§stat_sender: Sender<String>
§config_lock: Arc<RwLock<dyn Configuration + Send + Sync>>
§produce_blocks_by_timer: bool
§delete_old_blocks: bool
Implementations§
Source§impl ConsensusThread
impl ConsensusThread
pub async fn produce_block( &mut self, timestamp: Timestamp, gt_result: Option<&Transaction>, mempool: &mut Mempool, blockchain: &Blockchain, configs: &(dyn Configuration + Send + Sync), ) -> Option<Block>
pub async fn bundle_block( &mut self, timestamp: Timestamp, produce_without_limits: bool, ) -> bool
pub async fn add_gt_to_mempool(&mut self, golden_ticket: GoldenTicket)
Trait Implementations§
Source§impl ProcessEvent<ConsensusEvent> for ConsensusThread
impl ProcessEvent<ConsensusEvent> for ConsensusThread
Source§fn process_network_event<'life0, 'async_trait>(
&'life0 mut self,
_event: NetworkEvent,
) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn process_network_event<'life0, 'async_trait>(
&'life0 mut self,
_event: NetworkEvent,
) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Processes an event coming from other peers via network controller Read more
Source§fn process_timer_event<'life0, 'async_trait>(
&'life0 mut self,
duration: Duration,
) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn process_timer_event<'life0, 'async_trait>(
&'life0 mut self,
duration: Duration,
) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Triggered with each timer tick. duration will vary due to other processing tasks in the same thread. Read more
Source§fn process_event<'life0, 'async_trait>(
&'life0 mut self,
event: ConsensusEvent,
) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn process_event<'life0, 'async_trait>(
&'life0 mut self,
event: ConsensusEvent,
) -> Pin<Box<dyn Future<Output = Option<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Processes the incoming events from other threads/controllers. Read more
fn on_init<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_stat_interval<'life0, 'async_trait>(
&'life0 mut self,
current_time: Timestamp,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_ready_to_process(&self) -> bool
Auto Trait Implementations§
impl Freeze for ConsensusThread
impl !RefUnwindSafe for ConsensusThread
impl Send for ConsensusThread
impl Sync for ConsensusThread
impl Unpin for ConsensusThread
impl !UnwindSafe for ConsensusThread
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