Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose internal functions used by spawn_tasks #3166

Merged
merged 3 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions prdoc/pr_3166.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title: Expose internal functions used by `spawn_tasks`

doc:
- audience: Node Dev
description: |
This allows to build a custom version of `spawn_tasks` with less copy-paste required

crates:
- name: sc-service
11 changes: 7 additions & 4 deletions substrate/client/service/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ where
spawn_handle.spawn(
"on-transaction-imported",
Some("transaction-pool"),
transaction_notifications(
propagate_transaction_notifications(
transaction_pool.clone(),
tx_handler_controller,
telemetry.clone(),
Expand Down Expand Up @@ -532,7 +532,8 @@ where
Ok(rpc_handlers)
}

async fn transaction_notifications<Block, ExPool>(
/// Returns a future that forwards imported transactions to the transaction networking protocol.
pub async fn propagate_transaction_notifications<Block, ExPool>(
bkchr marked this conversation as resolved.
Show resolved Hide resolved
transaction_pool: Arc<ExPool>,
tx_handler_controller: sc_network_transactions::TransactionsHandlerController<
<Block as BlockT>::Hash,
Expand Down Expand Up @@ -560,7 +561,8 @@ async fn transaction_notifications<Block, ExPool>(
.await;
}

fn init_telemetry<Block, Client, Network>(
/// Initialize telemetry with provided configuration and return telemetry handle
pub fn init_telemetry<Block, Client, Network>(
config: &mut Configuration,
network: Network,
client: Arc<Client>,
Expand Down Expand Up @@ -598,7 +600,8 @@ where
Ok(telemetry.handle())
}

fn gen_rpc_module<TBl, TBackend, TCl, TRpc, TExPool>(
/// Generate RPC module using provided configuration
pub fn gen_rpc_module<TBl, TBackend, TCl, TRpc, TExPool>(
deny_unsafe: DenyUnsafe,
spawn_handle: SpawnTaskHandle,
client: Arc<TCl>,
Expand Down
2 changes: 1 addition & 1 deletion substrate/client/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ mod waiting {
}

/// Starts RPC servers.
fn start_rpc_servers<R>(
pub fn start_rpc_servers<R>(
config: &Configuration,
gen_rpc_module: R,
rpc_id_provider: Option<Box<dyn RpcSubscriptionIdProvider>>,
Expand Down
Loading