Skip to content

Commit

Permalink
chore: filter out already-connected feds
Browse files Browse the repository at this point in the history
  • Loading branch information
tvolk131 committed Sep 29, 2024
1 parent 66edeab commit ac885b2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/routes/bitcoin_wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,18 @@ impl Add {
.sort_by_key(|(_, pubkeys, _)| pubkeys.len());
federation_data_sorted_by_recommendations.reverse();

// Filter out federations that we're already connected to.
if let Loadable::Loaded(connected_federation_views) =
&connected_state.loadable_federation_views
{
let connected_federation_ids =
connected_federation_views.keys().collect::<BTreeSet<_>>();

federation_data_sorted_by_recommendations.retain(|(federation_id, _, _)| {
!connected_federation_ids.contains(federation_id)
});
}

for (federation_id, pubkeys, invite_codes) in
federation_data_sorted_by_recommendations
{
Expand Down

0 comments on commit ac885b2

Please sign in to comment.