Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Expose build_system_rpc_future and TransactionPoolAdapator in sc-…
Browse files Browse the repository at this point in the history
…service (#14238)

* Make block sync service customizable

This change allows user to have their own network block logic, for example, we'd like to disable
the builtin block sync service when using another syncing approach.

* Remove unnecessary Box

* Revert network_block

* Expose build_system_rpc_future() and TransactionPoolAdaptor

* fmt
  • Loading branch information
liuchengxu authored May 31, 2023
1 parent 7f1861e commit 7a64651
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions client/service/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@ pub struct BuildNetworkParams<'a, TBl: BlockT, TExPool, TImpQu, TCl> {
/// Optional warp sync params.
pub warp_sync_params: Option<WarpSyncParams<TBl>>,
}

/// Build the network service, the network status sinks and an RPC sender.
pub fn build_network<TBl, TExPool, TImpQu, TCl>(
params: BuildNetworkParams<TBl, TExPool, TImpQu, TCl>,
Expand Down
9 changes: 8 additions & 1 deletion client/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ async fn build_network_future<
}

/// Builds a future that processes system RPC requests.
async fn build_system_rpc_future<
pub async fn build_system_rpc_future<
B: BlockT,
C: BlockchainEvents<B>
+ HeaderBackend<B>
Expand Down Expand Up @@ -421,6 +421,13 @@ pub struct TransactionPoolAdapter<C, P> {
client: Arc<C>,
}

impl<C, P> TransactionPoolAdapter<C, P> {
/// Constructs a new instance of [`TransactionPoolAdapter`].
pub fn new(pool: Arc<P>, client: Arc<C>) -> Self {
Self { pool, client }
}
}

/// Get transactions for propagation.
///
/// Function extracted to simplify the test and prevent creating `ServiceFactory`.
Expand Down

0 comments on commit 7a64651

Please sign in to comment.