diff --git a/rpc/src/v1/helpers/dispatch.rs b/rpc/src/v1/helpers/dispatch.rs index 36d5ad864..5d36404e2 100644 --- a/rpc/src/v1/helpers/dispatch.rs +++ b/rpc/src/v1/helpers/dispatch.rs @@ -18,10 +18,13 @@ use std::fmt::Debug; use std::ops::Deref; -use std::sync::Weak; +use std::sync::{Arc, Weak}; use futures::{future, Future, BoxFuture}; -use util::{Address, H520, H256, U256, Uint, Bytes}; +use light::client::LightChainClient; +use light::on_demand::{request, OnDemand}; +use light::TransactionQueue as LightTransactionQueue; +use util::{Address, H520, H256, U256, Uint, Bytes, RwLock}; use util::sha3::Hashable; use ethkey::Signature; @@ -151,7 +154,36 @@ impl Dispatcher for FullDispatcher, + client: Arc, + on_demand: Arc, + transaction_queue: Arc>, +} + +impl LightDispatcher { + /// Create a new `LightDispatcher` from its requisite parts. + /// + /// For correct operation, the OnDemand service is assumed to be registered as a network handler, + pub fn new( + sync: Arc, + client: Arc, + on_demand: Arc, + transaction_queue: Arc>, + ) -> Self { + LightDispatcher { + sync: sync, + client: client, + on_demand: on_demand, + transaction_queue, } + } } /// default MAC to use.