@@ -4031,7 +4031,9 @@ where
40314031 Ok(temporary_channel_id)
40324032 }
40334033
4034- fn list_funded_channels_with_filter<Fn: FnMut(&(&ChannelId, &Channel<SP>)) -> bool + Copy>(
4034+ fn list_funded_channels_with_filter<
4035+ Fn: FnMut(&(&InitFeatures, &ChannelId, &Channel<SP>)) -> bool + Copy,
4036+ >(
40354037 &self, f: Fn,
40364038 ) -> Vec<ChannelDetails> {
40374039 // Allocate our best estimate of the number of channels we have in the `res`
@@ -4047,9 +4049,13 @@ where
40474049 let mut peer_state_lock = peer_state_mutex.lock().unwrap();
40484050 let peer_state = &mut *peer_state_lock;
40494051 // Only `Channels` in the `Channel::Funded` phase can be considered funded.
4050- let filtered_chan_by_id =
4051- peer_state.channel_by_id.iter().filter(|(_, chan)| chan.is_funded()).filter(f);
4052- res.extend(filtered_chan_by_id.map(|(_channel_id, channel)| {
4052+ let filtered_chan_by_id = peer_state
4053+ .channel_by_id
4054+ .iter()
4055+ .map(|(cid, c)| (&peer_state.latest_features, cid, c))
4056+ .filter(|(_, _, chan)| chan.is_funded())
4057+ .filter(f);
4058+ res.extend(filtered_chan_by_id.map(|(_, _channel_id, channel)| {
40534059 ChannelDetails::from_channel(
40544060 channel,
40554061 best_block_height,
@@ -4101,7 +4107,7 @@ where
41014107 // Note we use is_live here instead of usable which leads to somewhat confused
41024108 // internal/external nomenclature, but that's ok cause that's probably what the user
41034109 // really wanted anyway.
4104- self.list_funded_channels_with_filter(|&(_, ref channel)| channel.context().is_live())
4110+ self.list_funded_channels_with_filter(|&(_, _, ref channel)| channel.context().is_live())
41054111 }
41064112
41074113 /// Gets the list of channels we have with a given counterparty, in random order.
0 commit comments