Skip to content

Commit

Permalink
feat: log difficulty
Browse files Browse the repository at this point in the history
  • Loading branch information
GoudanWoo committed Aug 6, 2024
1 parent ed68622 commit ad035e9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/mine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,22 @@ impl Miner {
if nonce % 100 == 0 {
let global_best_difficulty = *global_best_difficulty.read().unwrap();
if timer.elapsed().as_secs().ge(&cutoff_time) {
if i == 0 {
progress_bar.set_message(format!(
"Mining... ({} / {} difficulty)",
global_best_difficulty,
min_difficulty,
));
}
if global_best_difficulty.ge(&min_difficulty) {
// Mine until min difficulty has been met
break;
}
} else if i == 0 {
progress_bar.set_message(format!(
"Mining... ({} sec remaining)",
"Mining... ({} / {} difficulty, {} sec remaining)",
global_best_difficulty,
min_difficulty,
cutoff_time.saturating_sub(timer.elapsed().as_secs()),
));
}
Expand Down

0 comments on commit ad035e9

Please sign in to comment.