Merge pull request #4930 from paritytech/notify-sealing-master

Ensure sealing work enabled in miner once subscribers added
This commit is contained in:
Marek Kotewicz 2017-03-18 15:19:02 +01:00 committed by GitHub
commit 91ab91cfb9
2 changed files with 5 additions and 2 deletions

View File

@ -234,7 +234,8 @@ pub struct Miner {
impl Miner {
/// Push notifier that will handle new jobs
pub fn push_notifier(&self, notifier: Box<NotifyWork>) {
self.notifiers.write().push(notifier)
self.notifiers.write().push(notifier);
self.sealing_work.lock().enabled = true;
}
/// Creates new instance of miner Arc.
@ -304,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()
}

View File

@ -211,6 +211,8 @@ impl From<AddrParseError> 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(