LightDispatcher definition
This commit is contained in:
parent
325c6aaf6a
commit
7be2c145de
@ -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;
|
||||
@ -154,6 +157,35 @@ impl<C: MiningBlockChainClient, M: MinerService> Dispatcher for FullDispatcher<C
|
||||
}
|
||||
}
|
||||
|
||||
/// Dispatcher for light clients -- fetches default gas price, next nonce, etc. from network.
|
||||
/// Light client `ETH` RPC.
|
||||
#[derive(Clone)]
|
||||
pub struct LightDispatcher {
|
||||
sync: Arc<LightSync>,
|
||||
client: Arc<LightChainClient>,
|
||||
on_demand: Arc<OnDemand>,
|
||||
transaction_queue: Arc<RwLock<LightTransactionQueue>>,
|
||||
}
|
||||
|
||||
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<LightSync>,
|
||||
client: Arc<LightChainClient>,
|
||||
on_demand: Arc<OnDemand>,
|
||||
transaction_queue: Arc<RwLock<LightTransactionQueue>>,
|
||||
) -> Self {
|
||||
LightDispatcher {
|
||||
sync: sync,
|
||||
client: client,
|
||||
on_demand: on_demand,
|
||||
transaction_queue,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// default MAC to use.
|
||||
pub const DEFAULT_MAC: [u8; 2] = [0, 0];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user