mirror of
https://github.com/logos-blockchain/logos-blockchain-testing.git
synced 2026-01-05 23:03:07 +00:00
refactor(cfgsync): clarify readiness mapping
This commit is contained in:
parent
91fe0c4985
commit
c2ac7f4dc0
@ -98,7 +98,10 @@ impl ConfigRepo {
|
|||||||
async fn run(&self) {
|
async fn run(&self) {
|
||||||
let timeout_duration = self.timeout_duration;
|
let timeout_duration = self.timeout_duration;
|
||||||
|
|
||||||
if timeout(timeout_duration, self.wait_for_hosts()).await == Ok(()) {
|
if timeout(timeout_duration, self.wait_for_hosts())
|
||||||
|
.await
|
||||||
|
.is_ok()
|
||||||
|
{
|
||||||
println!("All hosts have announced their IPs");
|
println!("All hosts have announced their IPs");
|
||||||
|
|
||||||
let mut waiting_hosts = self.waiting_hosts.lock().unwrap();
|
let mut waiting_hosts = self.waiting_hosts.lock().unwrap();
|
||||||
|
|||||||
@ -259,19 +259,28 @@ fn override_api_ports(config: &mut Value, ports: &PortOverrides) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn inject_da_assignations(config: &mut Value, membership: &nomos_node::NomosDaMembership) {
|
fn inject_da_assignations(config: &mut Value, membership: &nomos_node::NomosDaMembership) {
|
||||||
|
struct SubnetAssignment {
|
||||||
|
subnet_id: String,
|
||||||
|
peers: Vec<String>,
|
||||||
|
}
|
||||||
|
|
||||||
fn convert_subnet_to_assignment(
|
fn convert_subnet_to_assignment(
|
||||||
subnet_id: impl ToString,
|
subnet_id: impl ToString,
|
||||||
members: impl IntoIterator<Item = impl ToString>,
|
members: impl IntoIterator<Item = impl ToString>,
|
||||||
) -> (String, Vec<String>) {
|
) -> SubnetAssignment {
|
||||||
let peer_strings: Vec<String> = members.into_iter().map(|peer| peer.to_string()).collect();
|
let peers = members.into_iter().map(|peer| peer.to_string()).collect();
|
||||||
|
|
||||||
(subnet_id.to_string(), peer_strings)
|
SubnetAssignment {
|
||||||
|
subnet_id: subnet_id.to_string(),
|
||||||
|
peers,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let subnetworks = membership.subnetworks();
|
let subnetworks = membership.subnetworks();
|
||||||
let assignations: std::collections::HashMap<String, Vec<String>> = subnetworks
|
let assignations: std::collections::HashMap<String, Vec<String>> = subnetworks
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(subnet_id, members)| convert_subnet_to_assignment(subnet_id, members))
|
.map(|(subnet_id, members)| convert_subnet_to_assignment(subnet_id, members))
|
||||||
|
.map(|assignment| (assignment.subnet_id, assignment.peers))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
if let Some(membership) = config.pointer_mut("/da_network/membership") {
|
if let Some(membership) = config.pointer_mut("/da_network/membership") {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user