Skip to content

Commit

Permalink
test: Don't drop receiver before iterations are done
Browse files Browse the repository at this point in the history
Fix a test where the receiving-end of a channel was dropped too soon
which lead to guessing being aborted.
  • Loading branch information
Sword-Smith committed Jan 16, 2025
1 parent a1edbd4 commit 8b69daf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/mine_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ pub(crate) mod mine_loop_tests {
let tick = std::time::SystemTime::now();
let (kernel_auth_path, header_auth_path) = precalculate_block_auth_paths(&block);

let (worker_task_tx, _) = oneshot::channel::<NewBlockFound>();
let (worker_task_tx, worker_task_rx) = oneshot::channel::<NewBlockFound>();
let num_iterations_run =
rayon::iter::IntoParallelIterator::into_par_iter(0..num_iterations_launched)
.map_init(rand::thread_rng, |prng, _i| {
Expand All @@ -1048,6 +1048,7 @@ pub(crate) mod mine_loop_tests {
);
})
.count();
drop(worker_task_rx);

let time_spent_mining = tick.elapsed().unwrap();

Expand Down

0 comments on commit 8b69daf

Please sign in to comment.