From: Viktor Tigerström <11711198+ViktorTigerstrom@users.noreply.github.com> Date: Fri, 10 Jun 2022 00:01:36 +0000 (+0200) Subject: Remove unnecessary `per_peer_state` branch X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=209394195ffc88dd9a489e31350f507abcbda797;p=rust-lightning Remove unnecessary `per_peer_state` branch After `channels` are now stored in the `per_peer_state`, some logic can be simplified and extra accessing of the `per_peer_state` can be removed. --- diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index cda6fbbea..beccaf005 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -1590,7 +1590,7 @@ where channel_id: (*channel_id).clone(), counterparty: ChannelCounterparty { node_id: channel.get_counterparty_node_id(), - features: InitFeatures::empty(), + features: peer_state.latest_features.clone(), unspendable_punishment_reserve: to_remote_reserve_satoshis, forwarding_info: channel.counterparty_forwarding_info(), // Ensures that we have actually received the `htlc_minimum_msat` value @@ -1630,12 +1630,6 @@ where } } } - let per_peer_state = self.per_peer_state.read().unwrap(); - for chan in res.iter_mut() { - if let Some(peer_state) = per_peer_state.get(&chan.counterparty.node_id) { - chan.counterparty.features = peer_state.lock().unwrap().latest_features.clone(); - } - } res }