mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 10:31:03 +00:00
Allow to specify multiple relay chain RPC urls for collator node (#1880)
* Allow specification of multiple urls for relay chain rpc nodes * Add pooled RPC client basics * Add list of clients to pooled client * Improve * Forward requests to dispatcher * Switch clients on error * Implement rotation logic * Improve subscription handling * Error handling cleanup * Remove retry from rpc-client * Improve naming * Improve documentation * Improve `ClientManager` abstraction * Adjust zombienet test * Add more comments * fmt * Apply reviewers comments * Extract reconnection to extra method * Add comment to reconnection method * Clean up some dependencies * Fix build * fmt * Provide alias for cli argument * Apply review comments * Rename P* to Relay* * Improve zombienet test * fmt * Fix zombienet sleep * Simplify zombienet test * Reduce log clutter and fix starting position * Do not distribute duplicated imported and finalized blocks * fmt * Apply code review suggestions * Move building of relay chain interface to `cumulus-client-service` * Refactoring to not push back into channel * FMT
This commit is contained in:
@@ -363,13 +363,13 @@ impl BlockChainRpcClient {
|
||||
pub async fn import_notification_stream(
|
||||
&self,
|
||||
) -> RelayChainResult<Pin<Box<dyn Stream<Item = Header> + Send>>> {
|
||||
Ok(self.rpc_client.get_imported_heads_stream().await?.boxed())
|
||||
Ok(self.rpc_client.get_imported_heads_stream()?.boxed())
|
||||
}
|
||||
|
||||
pub async fn finality_notification_stream(
|
||||
&self,
|
||||
) -> RelayChainResult<Pin<Box<dyn Stream<Item = Header> + Send>>> {
|
||||
Ok(self.rpc_client.get_finalized_heads_stream().await?.boxed())
|
||||
Ok(self.rpc_client.get_finalized_heads_stream()?.boxed())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -223,8 +223,14 @@ async fn forward_collator_events(
|
||||
f = finality.next() => {
|
||||
match f {
|
||||
Some(header) => {
|
||||
tracing::info!(target: "minimal-polkadot-node", "Received finalized block via RPC: #{} ({})", header.number, header.hash());
|
||||
let block_info = BlockInfo { hash: header.hash(), parent_hash: header.parent_hash, number: header.number };
|
||||
tracing::info!(
|
||||
target: "minimal-polkadot-node",
|
||||
"Received finalized block via RPC: #{} ({} -> {})",
|
||||
header.number,
|
||||
header.parent_hash,
|
||||
header.hash()
|
||||
);
|
||||
let block_info = BlockInfo { hash: header.hash(), parent_hash: header.parent_hash, number: header.number };
|
||||
handle.block_finalized(block_info).await;
|
||||
}
|
||||
None => return Err(RelayChainError::GenericError("Relay chain finality stream ended.".to_string())),
|
||||
@@ -233,8 +239,14 @@ async fn forward_collator_events(
|
||||
i = imports.next() => {
|
||||
match i {
|
||||
Some(header) => {
|
||||
tracing::info!(target: "minimal-polkadot-node", "Received imported block via RPC: #{} ({})", header.number, header.hash());
|
||||
let block_info = BlockInfo { hash: header.hash(), parent_hash: header.parent_hash, number: header.number };
|
||||
tracing::info!(
|
||||
target: "minimal-polkadot-node",
|
||||
"Received imported block via RPC: #{} ({} -> {})",
|
||||
header.number,
|
||||
header.parent_hash,
|
||||
header.hash()
|
||||
);
|
||||
let block_info = BlockInfo { hash: header.hash(), parent_hash: header.parent_hash, number: header.number };
|
||||
handle.block_imported(block_info).await;
|
||||
}
|
||||
None => return Err(RelayChainError::GenericError("Relay chain import stream ended.".to_string())),
|
||||
|
||||
@@ -85,7 +85,7 @@ fn build_authority_discovery_service<Block: BlockT>(
|
||||
pub async fn build_minimal_relay_chain_node(
|
||||
polkadot_config: Configuration,
|
||||
task_manager: &mut TaskManager,
|
||||
relay_chain_url: Url,
|
||||
relay_chain_url: Vec<Url>,
|
||||
) -> RelayChainResult<(Arc<(dyn RelayChainInterface + 'static)>, Option<CollatorPair>)> {
|
||||
let client = cumulus_relay_chain_rpc_interface::create_client_and_start_worker(
|
||||
relay_chain_url,
|
||||
|
||||
Reference in New Issue
Block a user