Added target difficulty to statusbar.
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ use crate::{Bytes, Keystore};
|
|||||||
pub enum Event {
|
pub enum Event {
|
||||||
MinerStarted,
|
MinerStarted,
|
||||||
MinerStopped { success: bool, full: bool },
|
MinerStopped { success: bool, full: bool },
|
||||||
MinerStats { thread: usize, speed: u64, max_diff: u32 },
|
MinerStats { thread: usize, speed: u64, max_diff: u32, aim_diff: u32 },
|
||||||
KeyGeneratorStarted,
|
KeyGeneratorStarted,
|
||||||
KeyGeneratorStopped,
|
KeyGeneratorStopped,
|
||||||
KeyCreated { path: String, public: String, hash: String },
|
KeyCreated { path: String, public: String, hash: String },
|
||||||
|
|||||||
+1
-1
@@ -253,7 +253,7 @@ fn find_hash(context: Arc<Mutex<Context>>, mut block: Block, running: Arc<Atomic
|
|||||||
let speed = (nonce - prev_nonce) / (elapsed as u64 / 1000);
|
let speed = (nonce - prev_nonce) / (elapsed as u64 / 1000);
|
||||||
//debug!("Mining speed {} H/s, max difficulty {}", speed, max_diff);
|
//debug!("Mining speed {} H/s, max difficulty {}", speed, max_diff);
|
||||||
if let Ok(mut context) = context.lock() {
|
if let Ok(mut context) = context.lock() {
|
||||||
context.bus.post(Event::MinerStats { thread, speed, max_diff})
|
context.bus.post(Event::MinerStats { thread, speed, max_diff, aim_diff: difficulty })
|
||||||
}
|
}
|
||||||
time = Instant::now();
|
time = Instant::now();
|
||||||
prev_nonce = nonce;
|
prev_nonce = nonce;
|
||||||
|
|||||||
+2
-2
@@ -240,13 +240,13 @@ fn action_loaded(context: &Arc<Mutex<Context>>, web_view: &mut WebView<()>) {
|
|||||||
}
|
}
|
||||||
s
|
s
|
||||||
}
|
}
|
||||||
Event::MinerStats { thread, speed, max_diff } => {
|
Event::MinerStats { thread, speed, max_diff, aim_diff } => {
|
||||||
if status.max_diff < max_diff {
|
if status.max_diff < max_diff {
|
||||||
status.max_diff = max_diff;
|
status.max_diff = max_diff;
|
||||||
}
|
}
|
||||||
status.set_thread_speed(thread, speed);
|
status.set_thread_speed(thread, speed);
|
||||||
if thread == threads - 1 {
|
if thread == threads - 1 {
|
||||||
format!("setLeftStatusBarText('Mining speed {} H/s, max found difficulty {}.'); showMiningIndicator(true, false);", status.get_speed(), status.max_diff)
|
format!("setLeftStatusBarText('Mining speed {} H/s, max found difficulty {}/{}.'); showMiningIndicator(true, false);", status.get_speed(), status.max_diff, aim_diff)
|
||||||
} else {
|
} else {
|
||||||
String::new()
|
String::new()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user