Add a test for the ordering setting in channel_reestablish handling
[rust-lightning] / src / ln / channelmanager.rs
index fd638754756a881a8055bc70e19570c8df953537..6eff163d669e9601628e00a07e5049dc19489198 100644 (file)
@@ -471,6 +471,12 @@ macro_rules! return_monitor_err {
                                return Err(MsgHandleErrInternal::from_finish_shutdown("ChannelMonitor storage failure", channel_id, chan.force_shutdown(), $self.get_channel_update(&chan).ok()))
                        },
                        ChannelMonitorUpdateErr::TemporaryFailure => {
+                               if !$resend_commitment {
+                                       debug_assert!($action_type == RAACommitmentOrder::RevokeAndACKFirst || !$resend_raa);
+                               }
+                               if !$resend_raa {
+                                       debug_assert!($action_type == RAACommitmentOrder::CommitmentFirst || !$resend_commitment);
+                               }
                                $entry.get_mut().monitor_update_failed($action_type, $resend_raa, $resend_commitment, $failed_forwards, $failed_fails);
                                return Err(MsgHandleErrInternal::from_chan_no_close(ChannelError::Ignore("Failed to update ChannelMonitor"), *$entry.key()));
                        },