From 131aa14afa3f7417e38799010c22ad8f7938e45f Mon Sep 17 00:00:00 2001 From: NikVolf Date: Thu, 16 Mar 2017 03:37:50 +0300 Subject: [PATCH 1/2] ensure sealing work enabled if notifier registed --- ethcore/src/miner/miner.rs | 3 ++- ethcore/src/miner/stratum.rs | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ethcore/src/miner/miner.rs b/ethcore/src/miner/miner.rs index d9df86cef..3d1389f3c 100644 --- a/ethcore/src/miner/miner.rs +++ b/ethcore/src/miner/miner.rs @@ -234,7 +234,8 @@ pub struct Miner { impl Miner { /// Push notifier that will handle new jobs pub fn push_notifier(&self, notifier: Box) { - self.notifiers.write().push(notifier) + self.notifiers.write().push(notifier); + self.sealing_work.lock().enabled = true; } /// Creates new instance of miner Arc. diff --git a/ethcore/src/miner/stratum.rs b/ethcore/src/miner/stratum.rs index e67cbb5e1..4da5d1849 100644 --- a/ethcore/src/miner/stratum.rs +++ b/ethcore/src/miner/stratum.rs @@ -211,6 +211,8 @@ impl From for Error { impl super::work_notify::NotifyWork for Stratum { fn notify(&self, pow_hash: H256, difficulty: U256, number: u64) { + trace!(target: "stratum", "Notify work"); + self.service.push_work_all( self.dispatcher.payload(pow_hash, difficulty, number) ).unwrap_or_else( From daca82bdfca953a118a26271b1b78262ce218b65 Mon Sep 17 00:00:00 2001 From: NikVolf Date: Thu, 16 Mar 2017 04:09:26 +0300 Subject: [PATCH 2/2] fix condition check --- ethcore/src/miner/miner.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethcore/src/miner/miner.rs b/ethcore/src/miner/miner.rs index 3d1389f3c..5d8d73837 100644 --- a/ethcore/src/miner/miner.rs +++ b/ethcore/src/miner/miner.rs @@ -305,7 +305,7 @@ impl Miner { fn forced_sealing(&self) -> bool { self.options.force_sealing - || !self.options.new_work_notify.is_empty() + || !self.notifiers.read().is_empty() || Instant::now() > *self.next_mandatory_reseal.read() }