eth_syncing RPC for light client

This commit is contained in:
Robert Habermeier
2017-03-23 03:23:53 +01:00
parent a55001ad1d
commit b96eb45877
3 changed files with 65 additions and 5 deletions

View File

@@ -245,7 +245,22 @@ impl Eth for EthClient {
}
fn syncing(&self) -> Result<SyncStatus, Error> {
rpc_unimplemented!()
if self.sync.is_major_importing() {
let chain_info = self.client.chain_info();
let current_block = U256::from(chain_info.best_block_number);
let highest_block = self.sync.highest_block().map(U256::from)
.unwrap_or_else(|| current_block.clone());
Ok(SyncStatus::Info(SyncInfo {
starting_block: U256::from(self.sync.start_block()).into(),
current_block: current_block.into(),
highest_block: highest_block.into(),
warp_chunks_amount: None,
warp_chunks_processed: None,
}))
} else {
Ok(SyncStatus::None)
}
}
fn author(&self, _meta: Self::Metadata) -> BoxFuture<RpcH160, Error> {