Filters and block RPCs for the light client (#5320)
* block_hash method for LightChainClient * abstraction and futures-based eth_filter * log fetching for light client * add eth-filter delegate * eth_block fetching RPCs * return default accounts from on_demand * fix early exit * BlockNumber -> BlockId * early exit for no known block number.
This commit is contained in:
committed by
Gav Wood
parent
e84d03f31d
commit
daf1495c4e
@@ -67,7 +67,6 @@ impl IoHandler<ClientIoMessage> for QueueCull {
|
||||
|
||||
let (sync, on_demand, txq) = (self.sync.clone(), self.on_demand.clone(), self.txq.clone());
|
||||
let best_header = self.client.best_block_header();
|
||||
let start_nonce = self.client.engine().account_start_nonce();
|
||||
|
||||
info!(target: "cull", "Attempting to cull queued transactions from {} senders.", senders.len());
|
||||
self.remote.spawn_with_timeout(move || {
|
||||
@@ -75,8 +74,7 @@ impl IoHandler<ClientIoMessage> for QueueCull {
|
||||
// fetch the nonce of each sender in the queue.
|
||||
let nonce_futures = senders.iter()
|
||||
.map(|&address| request::Account { header: best_header.clone(), address: address })
|
||||
.map(|request| on_demand.account(ctx, request))
|
||||
.map(move |fut| fut.map(move |x| x.map(|acc| acc.nonce).unwrap_or(start_nonce)))
|
||||
.map(|request| on_demand.account(ctx, request).map(|acc| acc.nonce))
|
||||
.zip(senders.iter())
|
||||
.map(|(fut, &addr)| fut.map(move |nonce| (addr, nonce)));
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ impl Dependencies for FullDependencies {
|
||||
);
|
||||
handler.extend_with(client.to_delegate());
|
||||
|
||||
let filter_client = EthFilterClient::new(&self.client, &self.miner);
|
||||
let filter_client = EthFilterClient::new(self.client.clone(), self.miner.clone());
|
||||
handler.extend_with(filter_client.to_delegate());
|
||||
|
||||
add_signing_methods!(EthSigning, handler, self);
|
||||
@@ -377,9 +377,8 @@ impl Dependencies for LightDependencies {
|
||||
self.secret_store.clone(),
|
||||
self.cache.clone(),
|
||||
);
|
||||
handler.extend_with(client.to_delegate());
|
||||
|
||||
// TODO: filters.
|
||||
handler.extend_with(Eth::to_delegate(client.clone()));
|
||||
handler.extend_with(EthFilter::to_delegate(client));
|
||||
add_signing_methods!(EthSigning, handler, self);
|
||||
},
|
||||
Api::Personal => {
|
||||
|
||||
@@ -221,7 +221,8 @@ fn execute_light(cmd: RunCmd, can_restart: bool, logger: Arc<RotatingLogger>) ->
|
||||
}
|
||||
|
||||
// start on_demand service.
|
||||
let on_demand = Arc::new(::light::on_demand::OnDemand::new(cache.clone()));
|
||||
let account_start_nonce = service.client().engine().account_start_nonce();
|
||||
let on_demand = Arc::new(::light::on_demand::OnDemand::new(cache.clone(), account_start_nonce));
|
||||
|
||||
// set network path.
|
||||
net_conf.net_config_path = Some(db_dirs.network_path().to_string_lossy().into_owned());
|
||||
|
||||
Reference in New Issue
Block a user