Skip to content
This repository has been archived by the owner on Feb 3, 2025. It is now read-only.

Commit

Permalink
Fallback to first gateway if we don't find any
Browse files Browse the repository at this point in the history
  • Loading branch information
benthecarman committed Apr 8, 2024
1 parent cfef418 commit e778b08
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mutiny-core/src/federation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ fn get_gateway_preference(
let mainnet_federation_id =
FederationId::from_str(MAINNET_FEDERATION).expect("should be a valid federation id");

for g in gateways {
for g in gateways.iter() {
let g_id = g.info.gateway_id;

// if the gateway node ID matches what we expect for our signet/mainnet
Expand All @@ -744,6 +744,11 @@ fn get_gateway_preference(
}
}

// fallback to any gateway if none fit our criteria
if active_choice.is_none() {
active_choice = gateways.first().map(|g| g.info.gateway_id);
}

active_choice
}

Expand Down

0 comments on commit e778b08

Please sign in to comment.