Skip to content

Commit 0101507

Browse files
committed
Properly enforce that all ChannelMonitorUpdates are ordered
c99d3d7 updated `ChannelMonitorUpdate::update_id` to continue counting up even after the channel is closed. It, however, accidentally updated the `ChannelMonitorUpdate` application logic to skip testing that `ChannelMonitorUpdate`s are well-ordered after the channel has been closed (in an attempt to ensure other checks in the same conditional block were applied). This fixes that oversight.
1 parent 8def09d commit 0101507

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lightning/src/chain/channelmonitor.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -3150,8 +3150,11 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
31503150
panic!("Attempted to apply post-force-close ChannelMonitorUpdate that wasn't providing a payment preimage");
31513151
},
31523152
}
3153-
} else if self.latest_update_id + 1 != updates.update_id {
3154-
panic!("Attempted to apply ChannelMonitorUpdates out of order, check the update_id before passing an update to update_monitor!");
3153+
}
3154+
if updates.update_id != LEGACY_CLOSED_CHANNEL_UPDATE_ID {
3155+
if self.latest_update_id + 1 != updates.update_id {
3156+
panic!("Attempted to apply ChannelMonitorUpdates out of order, check the update_id before passing an update to update_monitor!");
3157+
}
31553158
}
31563159
let mut ret = Ok(());
31573160
let bounded_fee_estimator = LowerBoundedFeeEstimator::new(&**fee_estimator);

0 commit comments

Comments
 (0)