Skip to content

Commit

Permalink
Update crates/orchestrator/src/network_spec/relaychain.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Loris Moulin <[email protected]>
  • Loading branch information
pepoviola and l0r1s authored Sep 27, 2023
1 parent bc89de2 commit ce91dc5
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions crates/orchestrator/src/network_spec/relaychain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,17 @@ impl RelaychainSpec {
// We want to track the errors for all the nodes and report them ones
let mut errs: Vec<OrchestratorError> = Default::default();

let mut nodes: Vec<NodeSpec> = Default::default();
config.nodes().iter().for_each(|node_config| {
match NodeSpec::from_config(node_config, &chain_context) {
Ok(node) => nodes.push(node),
Err(err) => errs.push(err),
}
});
let (nodes, errs) = config
.nodes()
.iter()
.map(|node_config| NodeSpec::from_config(node_config, &chain_context))
.fold((vec![], vec![]), |(mut nodes, mut errs), result| {
match result {
Ok(node) => nodes.push(node),
Err(err) => errs.push(err),
}
(nodes, errs)
});

if !errs.is_empty() {
// TODO: merge errs
Expand Down

0 comments on commit ce91dc5

Please sign in to comment.