Clean up private channel route hint filtering
authorJeffrey Czyz <jkczyz@gmail.com>
Thu, 13 Oct 2022 20:49:58 +0000 (16:49 -0400)
committerJeffrey Czyz <jkczyz@gmail.com>
Tue, 18 Oct 2022 22:14:22 +0000 (17:14 -0500)
lightning-invoice/src/utils.rs

index 56f4fe879d8807880bc95b290835fa197ef92d71..4ab51b07f5896d00d8c43ace1e3fa2f932cb7d25 100644 (file)
@@ -439,8 +439,10 @@ fn filter_channels(channels: Vec<ChannelDetails>, min_inbound_capacity_msat: Opt
        // the payment value and where we're currently connected to the channel counterparty.
        // Even if we cannot satisfy both goals, always ensure we include *some* hints, preferring
        // those which meet at least one criteria.
-       filtered_channels.into_iter()
-               .filter(|(_counterparty_id, channel)| {
+       filtered_channels
+               .into_iter()
+               .map(|(_, channel)| channel)
+               .filter(|channel| {
                        if online_min_capacity_channel_exists {
                                channel.inbound_capacity_msat >= min_inbound_capacity && channel.is_usable
                        } else if min_capacity_channel_exists && online_channel_exists {
@@ -454,7 +456,7 @@ fn filter_channels(channels: Vec<ChannelDetails>, min_inbound_capacity_msat: Opt
                                channel.is_usable
                        } else { true }
                })
-               .map(|(_counterparty_id, channel)| route_hint_from_channel(channel))
+               .map(route_hint_from_channel)
                .collect::<Vec<RouteHint>>()
 }