adding check for a sync

This commit is contained in:
Nikolay Volf 2016-03-15 17:13:44 +01:00
parent 828d20629b
commit ab4bfbac0d
1 changed files with 8 additions and 0 deletions

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();