Skip to content

Commit de7133a

Browse files
committed
increment update id
1 parent 0c1e279 commit de7133a

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4253,6 +4253,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
42534253
// provide a preimage at this point.
42544254
ChannelMonitorUpdateStep::PaymentPreimage { .. } =>
42554255
debug_assert!(self.lockdown_from_offchain),
4256+
ChannelMonitorUpdateStep::EventGenerated { .. } => {},
42564257
_ => {
42574258
log_error!(logger, "Attempted to apply post-force-close ChannelMonitorUpdate of type {}", updates.updates[0].variant_name());
42584259
panic!("Attempted to apply post-force-close ChannelMonitorUpdate that wasn't providing a payment preimage");

lightning/src/ln/channelmanager.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4731,10 +4731,14 @@ where
47314731
funded_chan
47324732
);
47334733
} else {
4734-
let update_id = *peer_state
4735-
.closed_channel_monitor_update_ids
4736-
.get(&shutdown_res.channel_id)
4737-
.unwrap();
4734+
let update_id = if let Some(latest_update_id) =
4735+
peer_state.closed_channel_monitor_update_ids.get_mut(&shutdown_res.channel_id)
4736+
{
4737+
*latest_update_id = latest_update_id.saturating_add(1);
4738+
*latest_update_id
4739+
} else {
4740+
panic!("We need the latest ChannelMonitorUpdate ID to build a new update");
4741+
};
47384742
let monitor_update = ChannelMonitorUpdate {
47394743
update_id,
47404744
updates: vec![monitor_update_step],

0 commit comments

Comments
 (0)