Skip to content

Commit 92a1e49

Browse files
committed
Clean up private channel route hint filtering
1 parent a534dcc commit 92a1e49

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lightning-invoice/src/utils.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,10 @@ fn filter_channels(channels: Vec<ChannelDetails>, min_inbound_capacity_msat: Opt
439439
// the payment value and where we're currently connected to the channel counterparty.
440440
// Even if we cannot satisfy both goals, always ensure we include *some* hints, preferring
441441
// those which meet at least one criteria.
442-
filtered_channels.into_iter()
443-
.filter(|(_counterparty_id, channel)| {
442+
filtered_channels
443+
.into_iter()
444+
.map(|(_, channel)| channel)
445+
.filter(|channel| {
444446
if online_min_capacity_channel_exists {
445447
channel.inbound_capacity_msat >= min_inbound_capacity && channel.is_usable
446448
} else if min_capacity_channel_exists && online_channel_exists {
@@ -454,7 +456,7 @@ fn filter_channels(channels: Vec<ChannelDetails>, min_inbound_capacity_msat: Opt
454456
channel.is_usable
455457
} else { true }
456458
})
457-
.map(|(_counterparty_id, channel)| route_hint_from_channel(channel))
459+
.map(route_hint_from_channel)
458460
.collect::<Vec<RouteHint>>()
459461
}
460462

0 commit comments

Comments
 (0)