2025-12-01 12:48:39 +01:00
|
|
|
use testing_framework_core::scenario::{BlockFeed, BlockFeedTask, NodeClients, spawn_block_feed};
|
2025-12-11 10:08:49 +01:00
|
|
|
use tracing::{debug, info};
|
2025-12-01 12:48:39 +01:00
|
|
|
|
|
|
|
|
use crate::deployer::K8sRunnerError;
|
|
|
|
|
|
|
|
|
|
pub async fn spawn_block_feed_with(
|
|
|
|
|
node_clients: &NodeClients,
|
|
|
|
|
) -> Result<(BlockFeed, BlockFeedTask), K8sRunnerError> {
|
2025-12-11 10:08:49 +01:00
|
|
|
debug!(
|
|
|
|
|
validators = node_clients.validator_clients().len(),
|
|
|
|
|
executors = node_clients.executor_clients().len(),
|
|
|
|
|
"selecting node client for block feed"
|
|
|
|
|
);
|
|
|
|
|
|
2025-12-01 12:48:39 +01:00
|
|
|
let block_source_client = node_clients
|
2025-12-17 21:52:11 +01:00
|
|
|
.validator_clients()
|
|
|
|
|
.first()
|
|
|
|
|
.or_else(|| node_clients.any_client())
|
2025-12-01 12:48:39 +01:00
|
|
|
.cloned()
|
|
|
|
|
.ok_or(K8sRunnerError::BlockFeedMissing)?;
|
|
|
|
|
|
|
|
|
|
info!("starting block feed");
|
|
|
|
|
spawn_block_feed(block_source_client)
|
|
|
|
|
.await
|
|
|
|
|
.map_err(|source| K8sRunnerError::BlockFeed { source })
|
|
|
|
|
}
|