From 7be2c145deb2461957598fc75c0459cf5726e50c Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Thu, 9 Feb 2017 20:22:31 +0100 Subject: [PATCH] LightDispatcher definition --- rpc/src/v1/helpers/dispatch.rs | 36 ++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) 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.