From b8ca7c9256067c4bb4f2cbbda8e58209020cd0d2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Viktor=20Tigerstr=C3=B6m?= <11711198+ViktorTigerstrom@users.noreply.github.com> Date: Fri, 10 Jun 2022 02:01:36 +0200 Subject: [PATCH] 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. --- lightning/src/ln/channelmanager.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 0a88f97e5..7b2865bb1 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 } -- 2.39.5