pub struct MiningThread {Show 14 fields
pub wallet_lock: Arc<RwLock<Wallet>>,
pub sender_to_mempool: Sender<ConsensusEvent>,
pub timer: Timer,
pub miner_active: bool,
pub target: SaitoHash,
pub target_id: BlockId,
pub difficulty: u64,
pub public_key: SaitoPublicKey,
pub mined_golden_tickets: u64,
pub stat_sender: Sender<String>,
pub config_lock: Arc<RwLock<dyn Configuration + Send + Sync>>,
pub enabled: bool,
pub mining_iterations: u32,
pub mining_start: Timestamp,
}
Expand description
Manages the miner
Fields§
§wallet_lock: Arc<RwLock<Wallet>>
§sender_to_mempool: Sender<ConsensusEvent>
§timer: Timer
§miner_active: bool
§target: SaitoHash
§target_id: BlockId
§difficulty: u64
§public_key: SaitoPublicKey
§mined_golden_tickets: u64
§stat_sender: Sender<String>
§config_lock: Arc<RwLock<dyn Configuration + Send + Sync>>
§enabled: bool
§mining_iterations: u32
§mining_start: Timestamp
Implementations§
Source§impl MiningThread
impl MiningThread
pub async fn mine(&mut self) -> Option<GoldenTicket>
Trait Implementations§
Source§impl ProcessEvent<MiningEvent> for MiningThread
impl ProcessEvent<MiningEvent> for MiningThread
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: MiningEvent,
) -> 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: MiningEvent,
) -> 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 MiningThread
impl !RefUnwindSafe for MiningThread
impl Send for MiningThread
impl Sync for MiningThread
impl Unpin for MiningThread
impl !UnwindSafe for MiningThread
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