From 77e63f3e3fc1a56547d076a69d17f6c41a144fd8 Mon Sep 17 00:00:00 2001 From: Ignotus Peverell Date: Tue, 27 Mar 2018 08:22:11 +0000 Subject: [PATCH] Fix for async miner loop not resetting head (#877) --- grin/src/miner.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/grin/src/miner.rs b/grin/src/miner.rs index d580353b..0733122e 100644 --- a/grin/src/miner.rs +++ b/grin/src/miner.rs @@ -132,7 +132,7 @@ impl Miner { b: &mut Block, cuckoo_size: u32, head: &BlockHeader, - latest_hash: &Hash, + latest_hash: &mut Hash, attempt_time_per_block: u32, mining_stats: Arc>, ) -> Option { @@ -235,6 +235,8 @@ impl Miner { } // avoid busy wait thread::sleep(Duration::from_millis(100)); + + *latest_hash = self.chain.head().unwrap().last_block_h; } if sol == None { debug!( @@ -529,7 +531,7 @@ impl Miner { &mut b, cuckoo_size, &head, - &latest_hash, + &mut latest_hash, miner_config.attempt_time_per_block, mining_stats.clone(), );