Skip to content

Commit ad7b75e

Browse files
committed
f dedup channel update logic
1 parent abec852 commit ad7b75e

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

lightning/src/ln/channelmanager.rs

+8-18
Original file line numberDiff line numberDiff line change
@@ -3663,24 +3663,14 @@ where
36633663
if !channel_phase.context_mut().update_config(&config) {
36643664
continue;
36653665
}
3666-
match channel_phase {
3667-
ChannelPhase::Funded(channel) => {
3668-
if let Ok(msg) = self.get_channel_update_for_broadcast(channel) {
3669-
peer_state.pending_msg_events.push(events::MessageSendEvent::BroadcastChannelUpdate { msg });
3670-
} else if let Ok(msg) = self.get_channel_update_for_unicast(channel) {
3671-
peer_state.pending_msg_events.push(events::MessageSendEvent::SendChannelUpdate {
3672-
node_id: channel.context.get_counterparty_node_id(),
3673-
msg,
3674-
});
3675-
}
3676-
},
3677-
ChannelPhase::UnfundedOutboundV1(_) | ChannelPhase::UnfundedInboundV1(_) => {
3678-
let context = channel_phase.context_mut();
3679-
let mut config = context.config();
3680-
config.apply(config_update);
3681-
// We update the config, but we MUST NOT broadcast a `channel_update` before `channel_ready`
3682-
// which would be the case for pending inbound/outbound channels.
3683-
context.update_config(&config);
3666+
if let ChannelPhase::Funded(channel) = channel_phase {
3667+
if let Ok(msg) = self.get_channel_update_for_broadcast(channel) {
3668+
peer_state.pending_msg_events.push(events::MessageSendEvent::BroadcastChannelUpdate { msg });
3669+
} else if let Ok(msg) = self.get_channel_update_for_unicast(channel) {
3670+
peer_state.pending_msg_events.push(events::MessageSendEvent::SendChannelUpdate {
3671+
node_id: channel.context.get_counterparty_node_id(),
3672+
msg,
3673+
});
36843674
}
36853675
}
36863676
continue;

0 commit comments

Comments
 (0)