From: Jeffrey Czyz Date: Thu, 13 Oct 2022 20:49:58 +0000 (-0400) Subject: Clean up private channel route hint filtering X-Git-Tag: v0.0.112~4^2~1 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=92a1e499db5f4863113eb862d040ec0c0cffc514;p=rust-lightning Clean up private channel route hint filtering --- diff --git a/lightning-invoice/src/utils.rs b/lightning-invoice/src/utils.rs index 56f4fe87..4ab51b07 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::>() }