Skip to content

Commit

Permalink
Properly enforce that all ChannelMonitorUpdates are ordered
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
TheBlueMatt committed Nov 28, 2024
1 parent 1da5129 commit 94b57a4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lightning/src/chain/channelmonitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3150,8 +3150,11 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
panic!("Attempted to apply post-force-close ChannelMonitorUpdate that wasn't providing a payment preimage");
},
}
} else if self.latest_update_id + 1 != updates.update_id {
panic!("Attempted to apply ChannelMonitorUpdates out of order, check the update_id before passing an update to update_monitor!");
}
if updates.update_id != LEGACY_CLOSED_CHANNEL_UPDATE_ID {
if self.latest_update_id + 1 != updates.update_id {
panic!("Attempted to apply ChannelMonitorUpdates out of order, check the update_id before passing an update to update_monitor!");
}
}
let mut ret = Ok(());
let bounded_fee_estimator = LowerBoundedFeeEstimator::new(&**fee_estimator);
Expand Down

0 comments on commit 94b57a4

Please sign in to comment.