work is in progress

This commit is contained in:
Nikolay Volf
2016-03-10 21:56:02 +04:00
5 changed files with 35 additions and 35 deletions

View File

@@ -17,7 +17,7 @@
//! Eth rpc implementation.
use std::collections::HashMap;
use std::sync::{Arc, Weak, Mutex, RwLock};
use ethsync::{SyncStatusProvider, SyncState};
use ethsync::{SyncProvider, SyncState};
use jsonrpc_core::*;
use util::numbers::*;
use util::sha3::*;
@@ -33,14 +33,14 @@ use v1::helpers::{PollFilter, PollManager};
use util::keys::store::AccountProvider;
/// Eth rpc implementation.
pub struct EthClient<C, S, A> where C: BlockChainClient, S: SyncStatusProvider, A: AccountProvider {
pub struct EthClient<C, S, A> where C: BlockChainClient, S: SyncProvider, A: AccountProvider {
client: Weak<C>,
sync: Weak<S>,
accounts: Weak<A>,
hashrates: RwLock<HashMap<H256, u64>>,
}
impl<C, S, A> EthClient<C, S, A> where C: BlockChainClient, S: SyncStatusProvider, A: AccountProvider {
impl<C, S, A> EthClient<C, S, A> where C: BlockChainClient, S: SyncProvider, A: AccountProvider {
/// Creates new EthClient.
pub fn new(client: &Arc<C>, sync: &Arc<S>, accounts: &Arc<A>) -> Self {
EthClient {
@@ -97,7 +97,7 @@ impl<C, S, A> EthClient<C, S, A> where C: BlockChainClient, S: SyncStatusProvide
}
}
impl<C, S, A> Eth for EthClient<C, S, A> where C: BlockChainClient + 'static, S: SyncStatusProvider + 'static, A: AccountProvider + 'static {
impl<C, S, A> Eth for EthClient<C, S, A> where C: BlockChainClient + 'static, S: SyncProvider + 'static, A: AccountProvider + 'static {
fn protocol_version(&self, params: Params) -> Result<Value, Error> {
match params {
Params::None => to_value(&U256::from(take_weak!(self.sync).status().protocol_version)),

View File

@@ -17,15 +17,15 @@
//! Net rpc implementation.
use std::sync::{Arc, Weak};
use jsonrpc_core::*;
use ethsync::SyncStatusProvider;
use ethsync::SyncProvider;
use v1::traits::Net;
/// Net rpc implementation.
pub struct NetClient<S> where S: SyncStatusProvider {
pub struct NetClient<S> where S: SyncProvider {
sync: Weak<S>
}
impl<S> NetClient<S> where S: SyncStatusProvider {
impl<S> NetClient<S> where S: SyncProvider {
/// Creates new NetClient.
pub fn new(sync: &Arc<S>) -> Self {
NetClient {
@@ -34,7 +34,7 @@ impl<S> NetClient<S> where S: SyncStatusProvider {
}
}
impl<S> Net for NetClient<S> where S: SyncStatusProvider + 'static {
impl<S> Net for NetClient<S> where S: SyncProvider + 'static {
fn version(&self, _: Params) -> Result<Value, Error> {
Ok(Value::U64(take_weak!(self.sync).status().protocol_version as u64))
}