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 Oct 12, 2024
1 parent 2ad21bd commit d8ed8c2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/routes/bitcoin_wallet/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,16 @@ impl Page {
.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(wallet_view) = &self.connected_state.loadable_wallet_view {
let connected_federation_ids =
wallet_view.federations.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 d8ed8c2

Please sign in to comment.