Skip to content

Commit ef8147c

Browse files
committed
f
1 parent ecc224e commit ef8147c

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2531,32 +2531,6 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
25312531
let pending_msg_events = &mut channel_state.pending_msg_events;
25322532
let short_to_id = &mut channel_state.short_to_id;
25332533
channel_state.by_id.retain(|chan_id, chan| {
2534-
match chan.channel_update_status() {
2535-
ChannelUpdateStatus::Enabled if !chan.is_live() => chan.set_channel_update_status(ChannelUpdateStatus::DisabledStaged),
2536-
ChannelUpdateStatus::Disabled if chan.is_live() => chan.set_channel_update_status(ChannelUpdateStatus::EnabledStaged),
2537-
ChannelUpdateStatus::DisabledStaged if chan.is_live() => chan.set_channel_update_status(ChannelUpdateStatus::Enabled),
2538-
ChannelUpdateStatus::EnabledStaged if !chan.is_live() => chan.set_channel_update_status(ChannelUpdateStatus::Disabled),
2539-
ChannelUpdateStatus::DisabledStaged if !chan.is_live() => {
2540-
if let Ok(update) = self.get_channel_update_for_broadcast(&chan) {
2541-
pending_msg_events.push(events::MessageSendEvent::BroadcastChannelUpdate {
2542-
msg: update
2543-
});
2544-
}
2545-
should_persist = NotifyOption::DoPersist;
2546-
chan.set_channel_update_status(ChannelUpdateStatus::Disabled);
2547-
},
2548-
ChannelUpdateStatus::EnabledStaged if chan.is_live() => {
2549-
if let Ok(update) = self.get_channel_update_for_broadcast(&chan) {
2550-
pending_msg_events.push(events::MessageSendEvent::BroadcastChannelUpdate {
2551-
msg: update
2552-
});
2553-
}
2554-
should_persist = NotifyOption::DoPersist;
2555-
chan.set_channel_update_status(ChannelUpdateStatus::Enabled);
2556-
},
2557-
_ => {},
2558-
}
2559-
25602534
let counterparty_node_id = chan.get_counterparty_node_id();
25612535
let (mut retain_channel, chan_needs_persist, err) = self.update_channel_fee(short_to_id, pending_msg_events, chan_id, chan, new_feerate);
25622536
if chan_needs_persist == NotifyOption::DoPersist { should_persist = NotifyOption::DoPersist; }
@@ -2572,6 +2546,34 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
25722546
}
25732547
}
25742548

2549+
if retain_channel {
2550+
match chan.channel_update_status() {
2551+
ChannelUpdateStatus::Enabled if !chan.is_live() => chan.set_channel_update_status(ChannelUpdateStatus::DisabledStaged),
2552+
ChannelUpdateStatus::Disabled if chan.is_live() => chan.set_channel_update_status(ChannelUpdateStatus::EnabledStaged),
2553+
ChannelUpdateStatus::DisabledStaged if chan.is_live() => chan.set_channel_update_status(ChannelUpdateStatus::Enabled),
2554+
ChannelUpdateStatus::EnabledStaged if !chan.is_live() => chan.set_channel_update_status(ChannelUpdateStatus::Disabled),
2555+
ChannelUpdateStatus::DisabledStaged if !chan.is_live() => {
2556+
if let Ok(update) = self.get_channel_update_for_broadcast(&chan) {
2557+
pending_msg_events.push(events::MessageSendEvent::BroadcastChannelUpdate {
2558+
msg: update
2559+
});
2560+
}
2561+
should_persist = NotifyOption::DoPersist;
2562+
chan.set_channel_update_status(ChannelUpdateStatus::Disabled);
2563+
},
2564+
ChannelUpdateStatus::EnabledStaged if chan.is_live() => {
2565+
if let Ok(update) = self.get_channel_update_for_broadcast(&chan) {
2566+
pending_msg_events.push(events::MessageSendEvent::BroadcastChannelUpdate {
2567+
msg: update
2568+
});
2569+
}
2570+
should_persist = NotifyOption::DoPersist;
2571+
chan.set_channel_update_status(ChannelUpdateStatus::Enabled);
2572+
},
2573+
_ => {},
2574+
}
2575+
}
2576+
25752577
retain_channel
25762578
});
25772579
}

0 commit comments

Comments
 (0)