Skip to content

Commit 01aeba1

Browse files
committed
f fix compile
1 parent e60e6ed commit 01aeba1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lightning-invoice/src/utils.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,13 +381,13 @@ where
381381
/// channel with a higher or equal inbound capacity than `min_inbound_capacity_msat` exists
382382
/// * If any public channel exists, the returned `RouteHint`s will be empty, and the sender will
383383
/// need to find the path by looking at the public channels instead
384-
fn filter_channels(channels: Vec<ChannelDetails>, min_inbound_capacity_msat: Option<u64>) -> Vec<RouteHint>{
385-
let mut filtered_channels: HashMap<PublicKey, &ChannelDetails> = HashMap::new();
384+
fn filter_channels(mut channels: Vec<ChannelDetails>, min_inbound_capacity_msat: Option<u64>) -> Vec<RouteHint>{
385+
let mut filtered_channels: HashMap<PublicKey, ChannelDetails> = HashMap::new();
386386
let min_inbound_capacity = min_inbound_capacity_msat.unwrap_or(0);
387387
let mut min_capacity_channel_exists = false;
388388
let mut online_channel_exists = false;
389389

390-
for channel in channels.filter(|chan| chan.is_channel_ready) {
390+
for channel in channels.drain(..).filter(|chan| chan.is_channel_ready) {
391391
if channel.get_inbound_payment_scid().is_none() || channel.counterparty.forwarding_info.is_none() {
392392
continue;
393393
}
@@ -418,7 +418,7 @@ fn filter_channels(channels: Vec<ChannelDetails>, min_inbound_capacity_msat: Opt
418418
}
419419
}
420420

421-
let route_hint_from_channel = |channel: &ChannelDetails| {
421+
let route_hint_from_channel = |channel: ChannelDetails| {
422422
let forwarding_info = channel.counterparty.forwarding_info.as_ref().unwrap();
423423
RouteHint(vec![RouteHintHop {
424424
src_node_id: channel.counterparty.node_id,
@@ -447,7 +447,7 @@ fn filter_channels(channels: Vec<ChannelDetails>, min_inbound_capacity_msat: Opt
447447
channel.is_usable
448448
} else { true }
449449
})
450-
.map(|(_counterparty_id, channel)| route_hint_from_channel(&channel))
450+
.map(|(_counterparty_id, channel)| route_hint_from_channel(channel))
451451
.collect::<Vec<RouteHint>>()
452452
}
453453

0 commit comments

Comments
 (0)