mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 01:11:10 +00:00
Split the service initialisation up into seperate functions (#6332)
* Seperate out the complexity in ServiceBuilder::build_common into seperate functions * Fix line widths * Move some functions to their respective crates
This commit is contained in:
@@ -683,3 +683,23 @@ impl<PoolApi, Block> MaintainedTransactionPool for BasicPool<PoolApi, Block>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Inform the transaction pool about imported and finalized blocks.
|
||||
pub async fn notification_future<Client, Pool, Block>(
|
||||
client: Arc<Client>,
|
||||
txpool: Arc<Pool>
|
||||
)
|
||||
where
|
||||
Block: BlockT,
|
||||
Client: sc_client_api::BlockchainEvents<Block>,
|
||||
Pool: MaintainedTransactionPool<Block=Block>,
|
||||
{
|
||||
let import_stream = client.import_notification_stream().map(Into::into).fuse();
|
||||
let finality_stream = client.finality_notification_stream()
|
||||
.map(Into::into)
|
||||
.fuse();
|
||||
|
||||
futures::stream::select(import_stream, finality_stream)
|
||||
.for_each(|evt| txpool.maintain(evt))
|
||||
.await
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user