adding check for a sync

This commit is contained in:
Nikolay Volf 2016-03-15 17:13:44 +01:00 committed by arkpar
parent 35be0e9943
commit c20e761051

View File

@ -321,6 +321,14 @@ impl<C, S, A, M, EM> Eth for EthClient<C, S, A, M, EM>
fn work(&self, params: Params) -> Result<Value, Error> {
match params {
Params::None => {
// check if we a still syncing and return empty strings int that case
{
let sync = take_weak!(self.sync);
if sync.status().state != SyncState::Idle {
return to_value(&(String::new(), String::new(), String::new()));
}
}
let miner = take_weak!(self.miner);
let client = take_weak!(self.client);
let u = miner.sealing_block(client.deref()).lock().unwrap();