//! Net rpc implementation. use std::sync::Arc; use jsonrpc_core::*; use ethcore::sync::EthSync; use v1::traits::Net; /// Net rpc implementation. pub struct NetClient { sync: Arc } impl NetClient { /// Creates new NetClient. pub fn new(sync: Arc) -> Self { NetClient { sync: sync } } } impl Net for NetClient { fn version(&self, _: Params) -> Result { Ok(Value::U64(self.sync.status().protocol_version as u64)) } fn peer_count(&self, _params: Params) -> Result { Ok(Value::U64(self.sync.status().num_peers as u64)) } }