Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1123 from ethcore/fixstyling
Browse files Browse the repository at this point in the history
Fix styling - don't mix spaces with tabs!!!
  • Loading branch information
arkpar committed May 22, 2016
2 parents c8d2237 + 0c4cd00 commit f738f5e
Showing 1 changed file with 28 additions and 30 deletions.
58 changes: 28 additions & 30 deletions rpc/src/v1/impls/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ use util::keys::store::AccountProvider;
use serde;

/// Eth rpc implementation.
pub struct EthClient<C, S, A, M, EM>
where C: BlockChainClient,
S: SyncProvider,
A: AccountProvider,
M: MinerService,
EM: ExternalMinerService {
pub struct EthClient<C, S, A, M, EM> where
C: BlockChainClient,
S: SyncProvider,
A: AccountProvider,
M: MinerService,
EM: ExternalMinerService {

client: Weak<C>,
sync: Weak<S>,
accounts: Weak<A>,
Expand All @@ -55,12 +56,12 @@ pub struct EthClient<C, S, A, M, EM>
seed_compute: Mutex<SeedHashCompute>,
}

impl<C, S, A, M, EM> EthClient<C, S, A, M, EM>
where C: BlockChainClient,
S: SyncProvider,
A: AccountProvider,
M: MinerService,
EM: ExternalMinerService {
impl<C, S, A, M, EM> EthClient<C, S, A, M, EM> where
C: BlockChainClient,
S: SyncProvider,
A: AccountProvider,
M: MinerService,
EM: ExternalMinerService {

/// Creates new EthClient.
pub fn new(client: &Arc<C>, sync: &Arc<S>, accounts: &Arc<A>, miner: &Arc<M>, em: &Arc<EM>)
Expand Down Expand Up @@ -214,12 +215,12 @@ fn from_params_default_third<F1, F2>(params: Params) -> Result<(F1, F2, BlockNum
}
}

impl<C, S, A, M, EM> Eth for EthClient<C, S, A, M, EM>
where C: BlockChainClient + 'static,
S: SyncProvider + 'static,
A: AccountProvider + 'static,
M: MinerService + 'static,
EM: ExternalMinerService + 'static {
impl<C, S, A, M, EM> Eth for EthClient<C, S, A, M, EM> where
C: BlockChainClient + 'static,
S: SyncProvider + 'static,
A: AccountProvider + 'static,
M: MinerService + 'static,
EM: ExternalMinerService + 'static {

fn protocol_version(&self, params: Params) -> Result<Value, Error> {
match params {
Expand Down Expand Up @@ -252,23 +253,20 @@ impl<C, S, A, M, EM> Eth for EthClient<C, S, A, M, EM>
}
}

// TODO: do not hardcode author.
fn author(&self, params: Params) -> Result<Value, Error> {
match params {
Params::None => to_value(&take_weak!(self.miner).author()),
_ => Err(Error::invalid_params()),
}
}

// TODO: return real value of mining once it's implemented.
fn is_mining(&self, params: Params) -> Result<Value, Error> {
match params {
Params::None => to_value(&self.external_miner.is_mining()),
_ => Err(Error::invalid_params())
}
}

// TODO: return real hashrate once we have mining
fn hashrate(&self, params: Params) -> Result<Value, Error> {
match params {
Params::None => to_value(&self.external_miner.hashrate()),
Expand Down Expand Up @@ -550,18 +548,18 @@ impl<C, S, A, M, EM> Eth for EthClient<C, S, A, M, EM>
}

/// Eth filter rpc implementation.
pub struct EthFilterClient<C, M>
where C: BlockChainClient,
M: MinerService {
pub struct EthFilterClient<C, M> where
C: BlockChainClient,
M: MinerService {

client: Weak<C>,
miner: Weak<M>,
polls: Mutex<PollManager<PollFilter>>,
}

impl<C, M> EthFilterClient<C, M>
where C: BlockChainClient,
M: MinerService {
impl<C, M> EthFilterClient<C, M> where
C: BlockChainClient,
M: MinerService {

/// Creates new Eth filter client.
pub fn new(client: &Arc<C>, miner: &Arc<M>) -> Self {
Expand All @@ -573,9 +571,9 @@ impl<C, M> EthFilterClient<C, M>
}
}

impl<C, M> EthFilter for EthFilterClient<C, M>
where C: BlockChainClient + 'static,
M: MinerService + 'static {
impl<C, M> EthFilter for EthFilterClient<C, M> where
C: BlockChainClient + 'static,
M: MinerService + 'static {

fn new_filter(&self, params: Params) -> Result<Value, Error> {
from_params::<(Filter,)>(params)
Expand Down

0 comments on commit f738f5e

Please sign in to comment.