Ensure we always get the latest work when mining on submitted. (#1469)

* Ensure we always get the latest work when mining on submitted.

* Build fix.

* Smaller timeslices for the wait.
This commit is contained in:
Gav Wood 2016-06-28 18:46:09 +02:00 committed by GitHub
parent 38870fb3e4
commit a3758161ac
1 changed files with 8 additions and 0 deletions

View File

@ -18,6 +18,8 @@
extern crate ethash;
use std::thread;
use std::time::{Instant, Duration};
use std::sync::{Arc, Weak, Mutex};
use std::ops::Deref;
use ethsync::{SyncProvider, SyncState};
@ -479,6 +481,12 @@ impl<C, S, M, EM> Eth for EthClient<C, S, M, EM> where
trace!(target: "miner", "Syncing. Cannot give any work.");
return Err(no_work_err());
}
// Otherwise spin until our submitted block has been included.
let timeout = Instant::now() + Duration::from_millis(1000);
while Instant::now() < timeout && client.queue_info().total_queue_size() > 0 {
thread::sleep(Duration::from_millis(1));
}
}
let miner = take_weak!(self.miner);