Improve overall performance (#6699)

* Improve overall performance

* Clean up code

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Remove needless ::

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Remove needless ::

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
pscott
2020-07-21 14:46:49 +02:00
committed by GitHub
parent ab82eb1c98
commit 046fda914a
73 changed files with 141 additions and 144 deletions
+11 -11
View File
@@ -438,7 +438,7 @@ impl ServiceBuilder<(), (), (), (), (), (), (), (), (), (), ()> {
backend,
task_manager,
keystore,
fetcher: Some(fetcher.clone()),
fetcher: Some(fetcher),
select_chain: None,
import_queue: (),
finality_proof_request_builder: None,
@@ -1286,7 +1286,7 @@ fn gen_handler<TBl, TBackend, TExPool, TRpc, TCl>(
client.clone(),
subscriptions.clone(),
remote_backend.clone(),
on_demand.clone()
on_demand,
);
(chain, state, child_state)
@@ -1298,15 +1298,15 @@ fn gen_handler<TBl, TBackend, TExPool, TRpc, TCl>(
};
let author = sc_rpc::author::Author::new(
client.clone(),
transaction_pool.clone(),
client,
transaction_pool,
subscriptions,
keystore.clone(),
keystore,
deny_unsafe,
);
let system = system::System::new(system_info, system_rpc_tx.clone(), deny_unsafe);
let system = system::System::new(system_info, system_rpc_tx, deny_unsafe);
let maybe_offchain_rpc = offchain_storage.clone()
let maybe_offchain_rpc = offchain_storage
.map(|storage| {
let offchain = sc_rpc::offchain::Offchain::new(storage, deny_unsafe);
// FIXME: Use plain Option (don't collect into HashMap) when we upgrade to jsonrpc 14.1
@@ -1357,7 +1357,7 @@ fn build_network<TBl, TExPool, TImpQu, TCl>(
{
let transaction_pool_adapter = Arc::new(TransactionPoolAdapter {
imports_external_transactions: !matches!(config.role, Role::Light),
pool: transaction_pool.clone(),
pool: transaction_pool,
client: client.clone(),
});
@@ -1391,8 +1391,8 @@ fn build_network<TBl, TExPool, TImpQu, TCl>(
chain: client.clone(),
finality_proof_provider,
finality_proof_request_builder,
on_demand: on_demand.clone(),
transaction_pool: transaction_pool_adapter.clone() as _,
on_demand: on_demand,
transaction_pool: transaction_pool_adapter as _,
import_queue: Box::new(import_queue),
protocol_id,
block_announce_validator,
@@ -1407,7 +1407,7 @@ fn build_network<TBl, TExPool, TImpQu, TCl>(
let future = build_network_future(
config.role.clone(),
network_mut,
client.clone(),
client,
network_status_sinks.clone(),
system_rpc_rx,
has_bootnodes,
@@ -52,8 +52,8 @@ impl<B: BlockT> BlockRules<B> {
bad_blocks: BadBlocks<B>,
) -> Self {
Self {
bad: bad_blocks.unwrap_or(HashSet::new()),
forks: fork_blocks.unwrap_or(vec![]).into_iter().collect(),
bad: bad_blocks.unwrap_or_else(|| HashSet::new()),
forks: fork_blocks.unwrap_or_else(|| vec![]).into_iter().collect(),
}
}