Fixed key generated success message.

This commit is contained in:
Revertron
2021-04-06 11:21:31 +02:00
parent 90cc26da4a
commit db86bfcd07
3 changed files with 7 additions and 12 deletions
+1 -3
View File
@@ -168,7 +168,6 @@ pub fn create_key(context: Arc<Mutex<Context>>) {
let miners_count = miners_count.clone();
thread::spawn(move || {
miners_count.fetch_add(1, atomic::Ordering::SeqCst);
let mut success = false;
match generate_key(KEYSTORE_DIFFICULTY, mining.clone()) {
None => {
debug!("Keystore mining finished");
@@ -180,12 +179,11 @@ pub fn create_key(context: Arc<Mutex<Context>>) {
info!("Key mined successfully: {:?}, hash: {}", &keystore.get_public(), &hash);
context.bus.post(Event::KeyCreated { path: keystore.get_path().to_owned(), public: keystore.get_public().to_string(), hash });
context.set_keystore(Some(keystore));
success = true;
}
}
let miners = miners_count.fetch_sub(1, atomic::Ordering::SeqCst) - 1;
if miners == 0 {
context.lock().unwrap().bus.post(Event::KeyGeneratorStopped { success });
context.lock().unwrap().bus.post(Event::KeyGeneratorStopped);
}
});
}