Wire-in Updater to parity RPC

This commit is contained in:
Gav Wood
2016-12-11 23:15:52 +01:00
parent d8ad09b654
commit d81d9d77b2
5 changed files with 15 additions and 4 deletions

View File

@@ -37,6 +37,7 @@ extern crate ethcore_ipc;
extern crate time;
extern crate rlp;
extern crate fetch;
extern crate parity_updater as updater;
#[macro_use]
extern crate log;

View File

@@ -30,6 +30,7 @@ use ethcore::miner::MinerService;
use ethcore::client::{MiningBlockChainClient};
use ethcore::mode::Mode;
use ethcore::account_provider::AccountProvider;
use updater::{Service as UpdateService};
use jsonrpc_core::Error;
use v1::traits::Parity;
@@ -44,14 +45,16 @@ use v1::helpers::dispatch::DEFAULT_MAC;
use v1::helpers::auto_args::Trailing;
/// Parity implementation.
pub struct ParityClient<C, M, S: ?Sized> where
pub struct ParityClient<C, M, S: ?Sized, U> where
C: MiningBlockChainClient,
M: MinerService,
S: SyncProvider,
U: UpdateService,
{
client: Weak<C>,
miner: Weak<M>,
sync: Weak<S>,
updater: Weak<U>,
net: Weak<ManageNetwork>,
accounts: Weak<AccountProvider>,
logger: Arc<RotatingLogger>,
@@ -61,16 +64,18 @@ pub struct ParityClient<C, M, S: ?Sized> where
dapps_port: Option<u16>,
}
impl<C, M, S: ?Sized> ParityClient<C, M, S> where
impl<C, M, S: ?Sized, U> ParityClient<C, M, S, U> where
C: MiningBlockChainClient,
M: MinerService,
S: SyncProvider,
U: UpdateService,
{
/// Creates new `ParityClient`.
pub fn new(
client: &Arc<C>,
miner: &Arc<M>,
sync: &Arc<S>,
updater: &Arc<U>,
net: &Arc<ManageNetwork>,
store: &Arc<AccountProvider>,
logger: Arc<RotatingLogger>,
@@ -83,6 +88,7 @@ impl<C, M, S: ?Sized> ParityClient<C, M, S> where
client: Arc::downgrade(client),
miner: Arc::downgrade(miner),
sync: Arc::downgrade(sync),
updater: Arc::downgrade(updater),
net: Arc::downgrade(net),
accounts: Arc::downgrade(store),
logger: logger,
@@ -100,10 +106,11 @@ impl<C, M, S: ?Sized> ParityClient<C, M, S> where
}
}
impl<C, M, S: ?Sized> Parity for ParityClient<C, M, S> where
impl<C, M, S: ?Sized, U> Parity for ParityClient<C, M, S, U> where
M: MinerService + 'static,
C: MiningBlockChainClient + 'static,
S: SyncProvider + 'static {
S: SyncProvider + 'static,
U: UpdateService + 'static {
fn transactions_limit(&self) -> Result<usize, Error> {
try!(self.active());