From 92a1e499db5f4863113eb862d040ec0c0cffc514 Mon Sep 17 00:00:00 2001 From: Jeffrey Czyz Date: Thu, 13 Oct 2022 16:49:58 -0400 Subject: [PATCH] Clean up private channel route hint filtering --- lightning-invoice/src/utils.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lightning-invoice/src/utils.rs b/lightning-invoice/src/utils.rs index 56f4fe879..4ab51b07f 100644 --- a/lightning-invoice/src/utils.rs +++ b/lightning-invoice/src/utils.rs @@ -439,8 +439,10 @@ fn filter_channels(channels: Vec, 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, 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::>() } -- 2.39.5