@@ -4038,7 +4038,9 @@ where
40384038 Ok(temporary_channel_id)
40394039 }
40404040
4041- fn list_funded_channels_with_filter<Fn: FnMut(&(&ChannelId, &Channel<SP>)) -> bool + Copy>(
4041+ fn list_funded_channels_with_filter<
4042+ Fn: FnMut(&(&InitFeatures, &ChannelId, &Channel<SP>)) -> bool + Copy,
4043+ >(
40424044 &self, f: Fn,
40434045 ) -> Vec<ChannelDetails> {
40444046 // Allocate our best estimate of the number of channels we have in the `res`
@@ -4054,9 +4056,13 @@ where
40544056 let mut peer_state_lock = peer_state_mutex.lock().unwrap();
40554057 let peer_state = &mut *peer_state_lock;
40564058 // Only `Channels` in the `Channel::Funded` phase can be considered funded.
4057- let filtered_chan_by_id =
4058- peer_state.channel_by_id.iter().filter(|(_, chan)| chan.is_funded()).filter(f);
4059- res.extend(filtered_chan_by_id.map(|(_channel_id, channel)| {
4059+ let filtered_chan_by_id = peer_state
4060+ .channel_by_id
4061+ .iter()
4062+ .map(|(cid, c)| (&peer_state.latest_features, cid, c))
4063+ .filter(|(_, _, chan)| chan.is_funded())
4064+ .filter(f);
4065+ res.extend(filtered_chan_by_id.map(|(_, _channel_id, channel)| {
40604066 ChannelDetails::from_channel(
40614067 channel,
40624068 best_block_height,
@@ -4108,7 +4114,7 @@ where
41084114 // Note we use is_live here instead of usable which leads to somewhat confused
41094115 // internal/external nomenclature, but that's ok cause that's probably what the user
41104116 // really wanted anyway.
4111- self.list_funded_channels_with_filter(|&(_, ref channel)| channel.context().is_live())
4117+ self.list_funded_channels_with_filter(|&(_, _, ref channel)| channel.context().is_live())
41124118 }
41134119
41144120 /// Gets the list of channels we have with a given counterparty, in random order.
0 commit comments