Wire-in Updater to parity RPC
This commit is contained in:
parent
d8ad09b654
commit
d81d9d77b2
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -521,6 +521,7 @@ dependencies = [
|
|||||||
"jsonrpc-http-server 6.1.1 (git+https://github.com/ethcore/jsonrpc.git)",
|
"jsonrpc-http-server 6.1.1 (git+https://github.com/ethcore/jsonrpc.git)",
|
||||||
"jsonrpc-ipc-server 0.2.4 (git+https://github.com/ethcore/jsonrpc.git)",
|
"jsonrpc-ipc-server 0.2.4 (git+https://github.com/ethcore/jsonrpc.git)",
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"parity-updater 1.5.0",
|
||||||
"rlp 0.1.0",
|
"rlp 0.1.0",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -225,6 +225,7 @@ pub fn setup_rpc<T: Extendable>(server: T, deps: Arc<Dependencies>, apis: ApiSet
|
|||||||
&deps.client,
|
&deps.client,
|
||||||
&deps.miner,
|
&deps.miner,
|
||||||
&deps.sync,
|
&deps.sync,
|
||||||
|
&deps.updater,
|
||||||
&deps.net_service,
|
&deps.net_service,
|
||||||
&deps.secret_store,
|
&deps.secret_store,
|
||||||
deps.logger.clone(),
|
deps.logger.clone(),
|
||||||
|
@ -25,6 +25,7 @@ ethash = { path = "../ethash" }
|
|||||||
ethsync = { path = "../sync" }
|
ethsync = { path = "../sync" }
|
||||||
ethjson = { path = "../json" }
|
ethjson = { path = "../json" }
|
||||||
ethcore-devtools = { path = "../devtools" }
|
ethcore-devtools = { path = "../devtools" }
|
||||||
|
parity-updater = { path = "../updater" }
|
||||||
rlp = { path = "../util/rlp" }
|
rlp = { path = "../util/rlp" }
|
||||||
fetch = { path = "../util/fetch" }
|
fetch = { path = "../util/fetch" }
|
||||||
rustc-serialize = "0.3"
|
rustc-serialize = "0.3"
|
||||||
|
@ -37,6 +37,7 @@ extern crate ethcore_ipc;
|
|||||||
extern crate time;
|
extern crate time;
|
||||||
extern crate rlp;
|
extern crate rlp;
|
||||||
extern crate fetch;
|
extern crate fetch;
|
||||||
|
extern crate parity_updater as updater;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
@ -30,6 +30,7 @@ use ethcore::miner::MinerService;
|
|||||||
use ethcore::client::{MiningBlockChainClient};
|
use ethcore::client::{MiningBlockChainClient};
|
||||||
use ethcore::mode::Mode;
|
use ethcore::mode::Mode;
|
||||||
use ethcore::account_provider::AccountProvider;
|
use ethcore::account_provider::AccountProvider;
|
||||||
|
use updater::{Service as UpdateService};
|
||||||
|
|
||||||
use jsonrpc_core::Error;
|
use jsonrpc_core::Error;
|
||||||
use v1::traits::Parity;
|
use v1::traits::Parity;
|
||||||
@ -44,14 +45,16 @@ use v1::helpers::dispatch::DEFAULT_MAC;
|
|||||||
use v1::helpers::auto_args::Trailing;
|
use v1::helpers::auto_args::Trailing;
|
||||||
|
|
||||||
/// Parity implementation.
|
/// Parity implementation.
|
||||||
pub struct ParityClient<C, M, S: ?Sized> where
|
pub struct ParityClient<C, M, S: ?Sized, U> where
|
||||||
C: MiningBlockChainClient,
|
C: MiningBlockChainClient,
|
||||||
M: MinerService,
|
M: MinerService,
|
||||||
S: SyncProvider,
|
S: SyncProvider,
|
||||||
|
U: UpdateService,
|
||||||
{
|
{
|
||||||
client: Weak<C>,
|
client: Weak<C>,
|
||||||
miner: Weak<M>,
|
miner: Weak<M>,
|
||||||
sync: Weak<S>,
|
sync: Weak<S>,
|
||||||
|
updater: Weak<U>,
|
||||||
net: Weak<ManageNetwork>,
|
net: Weak<ManageNetwork>,
|
||||||
accounts: Weak<AccountProvider>,
|
accounts: Weak<AccountProvider>,
|
||||||
logger: Arc<RotatingLogger>,
|
logger: Arc<RotatingLogger>,
|
||||||
@ -61,16 +64,18 @@ pub struct ParityClient<C, M, S: ?Sized> where
|
|||||||
dapps_port: Option<u16>,
|
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,
|
C: MiningBlockChainClient,
|
||||||
M: MinerService,
|
M: MinerService,
|
||||||
S: SyncProvider,
|
S: SyncProvider,
|
||||||
|
U: UpdateService,
|
||||||
{
|
{
|
||||||
/// Creates new `ParityClient`.
|
/// Creates new `ParityClient`.
|
||||||
pub fn new(
|
pub fn new(
|
||||||
client: &Arc<C>,
|
client: &Arc<C>,
|
||||||
miner: &Arc<M>,
|
miner: &Arc<M>,
|
||||||
sync: &Arc<S>,
|
sync: &Arc<S>,
|
||||||
|
updater: &Arc<U>,
|
||||||
net: &Arc<ManageNetwork>,
|
net: &Arc<ManageNetwork>,
|
||||||
store: &Arc<AccountProvider>,
|
store: &Arc<AccountProvider>,
|
||||||
logger: Arc<RotatingLogger>,
|
logger: Arc<RotatingLogger>,
|
||||||
@ -83,6 +88,7 @@ impl<C, M, S: ?Sized> ParityClient<C, M, S> where
|
|||||||
client: Arc::downgrade(client),
|
client: Arc::downgrade(client),
|
||||||
miner: Arc::downgrade(miner),
|
miner: Arc::downgrade(miner),
|
||||||
sync: Arc::downgrade(sync),
|
sync: Arc::downgrade(sync),
|
||||||
|
updater: Arc::downgrade(updater),
|
||||||
net: Arc::downgrade(net),
|
net: Arc::downgrade(net),
|
||||||
accounts: Arc::downgrade(store),
|
accounts: Arc::downgrade(store),
|
||||||
logger: logger,
|
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,
|
M: MinerService + 'static,
|
||||||
C: MiningBlockChainClient + 'static,
|
C: MiningBlockChainClient + 'static,
|
||||||
S: SyncProvider + 'static {
|
S: SyncProvider + 'static,
|
||||||
|
U: UpdateService + 'static {
|
||||||
|
|
||||||
fn transactions_limit(&self) -> Result<usize, Error> {
|
fn transactions_limit(&self) -> Result<usize, Error> {
|
||||||
try!(self.active());
|
try!(self.active());
|
||||||
|
Loading…
Reference in New Issue
Block a user