@@ -4837,6 +4837,15 @@ macro_rules! handle_chan_reestablish_msgs {
4837
4837
}
4838
4838
}
4839
4839
4840
+ let mut tx_signatures = None ;
4841
+ if let Some ( & MessageSendEvent :: SendTxSignatures { ref node_id, ref msg } ) =
4842
+ msg_events. get( idx)
4843
+ {
4844
+ assert_eq!( * node_id, $dst_node. node. get_our_node_id( ) ) ;
4845
+ tx_signatures = Some ( msg. clone( ) ) ;
4846
+ idx += 1 ;
4847
+ }
4848
+
4840
4849
if let Some ( & MessageSendEvent :: SendChannelUpdate { ref node_id, .. } ) = msg_events. get( idx)
4841
4850
{
4842
4851
assert_eq!( * node_id, $dst_node. node. get_our_node_id( ) ) ;
@@ -4855,7 +4864,7 @@ macro_rules! handle_chan_reestablish_msgs {
4855
4864
4856
4865
assert_eq!( msg_events. len( ) , idx, "{msg_events:?}" ) ;
4857
4866
4858
- ( channel_ready, revoke_and_ack, commitment_update, order, announcement_sigs)
4867
+ ( channel_ready, revoke_and_ack, commitment_update, order, announcement_sigs, tx_signatures )
4859
4868
} } ;
4860
4869
}
4861
4870
@@ -4864,6 +4873,9 @@ pub struct ReconnectArgs<'a, 'b, 'c, 'd> {
4864
4873
pub node_b : & ' a Node < ' b , ' c , ' d > ,
4865
4874
pub send_channel_ready : ( bool , bool ) ,
4866
4875
pub send_announcement_sigs : ( bool , bool ) ,
4876
+ pub send_interactive_tx_commit_sig : ( bool , bool ) ,
4877
+ pub send_interactive_tx_sigs : ( bool , bool ) ,
4878
+ pub expect_renegotiated_funding_locked_monitor_update : ( bool , bool ) ,
4867
4879
pub pending_responding_commitment_signed : ( bool , bool ) ,
4868
4880
/// Indicates that the pending responding commitment signed will be a dup for the recipient,
4869
4881
/// and no monitor update is expected
@@ -4883,6 +4895,9 @@ impl<'a, 'b, 'c, 'd> ReconnectArgs<'a, 'b, 'c, 'd> {
4883
4895
node_b,
4884
4896
send_channel_ready : ( false , false ) ,
4885
4897
send_announcement_sigs : ( false , false ) ,
4898
+ send_interactive_tx_commit_sig : ( false , false ) ,
4899
+ send_interactive_tx_sigs : ( false , false ) ,
4900
+ expect_renegotiated_funding_locked_monitor_update : ( false , false ) ,
4886
4901
pending_responding_commitment_signed : ( false , false ) ,
4887
4902
pending_responding_commitment_signed_dup_monitor : ( false , false ) ,
4888
4903
pending_htlc_adds : ( 0 , 0 ) ,
@@ -4903,6 +4918,9 @@ pub fn reconnect_nodes<'a, 'b, 'c, 'd>(args: ReconnectArgs<'a, 'b, 'c, 'd>) {
4903
4918
node_b,
4904
4919
send_channel_ready,
4905
4920
send_announcement_sigs,
4921
+ send_interactive_tx_commit_sig,
4922
+ send_interactive_tx_sigs,
4923
+ expect_renegotiated_funding_locked_monitor_update,
4906
4924
pending_htlc_adds,
4907
4925
pending_htlc_claims,
4908
4926
pending_htlc_fails,
@@ -4953,7 +4971,11 @@ pub fn reconnect_nodes<'a, 'b, 'c, 'd>(args: ReconnectArgs<'a, 'b, 'c, 'd>) {
4953
4971
node_b. node . handle_channel_reestablish ( node_a_id, & msg) ;
4954
4972
resp_1. push ( handle_chan_reestablish_msgs ! ( node_b, node_a) ) ;
4955
4973
}
4956
- if pending_cell_htlc_claims. 0 != 0 || pending_cell_htlc_fails. 0 != 0 {
4974
+
4975
+ if pending_cell_htlc_claims. 0 != 0
4976
+ || pending_cell_htlc_fails. 0 != 0
4977
+ || expect_renegotiated_funding_locked_monitor_update. 1
4978
+ {
4957
4979
check_added_monitors ! ( node_b, 1 ) ;
4958
4980
} else {
4959
4981
check_added_monitors ! ( node_b, 0 ) ;
@@ -4964,7 +4986,10 @@ pub fn reconnect_nodes<'a, 'b, 'c, 'd>(args: ReconnectArgs<'a, 'b, 'c, 'd>) {
4964
4986
node_a. node . handle_channel_reestablish ( node_b_id, & msg) ;
4965
4987
resp_2. push ( handle_chan_reestablish_msgs ! ( node_a, node_b) ) ;
4966
4988
}
4967
- if pending_cell_htlc_claims. 1 != 0 || pending_cell_htlc_fails. 1 != 0 {
4989
+ if pending_cell_htlc_claims. 1 != 0
4990
+ || pending_cell_htlc_fails. 1 != 0
4991
+ || expect_renegotiated_funding_locked_monitor_update. 0
4992
+ {
4968
4993
check_added_monitors ! ( node_a, 1 ) ;
4969
4994
} else {
4970
4995
check_added_monitors ! ( node_a, 0 ) ;
@@ -5011,6 +5036,21 @@ pub fn reconnect_nodes<'a, 'b, 'c, 'd>(args: ReconnectArgs<'a, 'b, 'c, 'd>) {
5011
5036
} else {
5012
5037
assert ! ( chan_msgs. 4 . is_none( ) ) ;
5013
5038
}
5039
+ if send_interactive_tx_commit_sig. 0 {
5040
+ assert ! ( chan_msgs. 1 . is_none( ) ) ;
5041
+ let commitment_update = chan_msgs. 2 . take ( ) . unwrap ( ) ;
5042
+ assert_eq ! ( commitment_update. commitment_signed. len( ) , 1 ) ;
5043
+ node_a. node . handle_commitment_signed_batch_test (
5044
+ node_b_id,
5045
+ & commitment_update. commitment_signed ,
5046
+ )
5047
+ }
5048
+ if send_interactive_tx_sigs. 0 {
5049
+ let tx_signatures = chan_msgs. 5 . take ( ) . unwrap ( ) ;
5050
+ node_a. node . handle_tx_signatures ( node_b_id, & tx_signatures) ;
5051
+ } else {
5052
+ assert ! ( chan_msgs. 5 . is_none( ) ) ;
5053
+ }
5014
5054
if pending_raa. 0 {
5015
5055
assert ! ( chan_msgs. 3 == RAACommitmentOrder :: RevokeAndACKFirst ) ;
5016
5056
node_a. node . handle_revoke_and_ack ( node_b_id, & chan_msgs. 1 . unwrap ( ) ) ;
@@ -5102,6 +5142,21 @@ pub fn reconnect_nodes<'a, 'b, 'c, 'd>(args: ReconnectArgs<'a, 'b, 'c, 'd>) {
5102
5142
} else {
5103
5143
assert ! ( chan_msgs. 4 . is_none( ) ) ;
5104
5144
}
5145
+ if send_interactive_tx_commit_sig. 1 {
5146
+ assert ! ( chan_msgs. 1 . is_none( ) ) ;
5147
+ let commitment_update = chan_msgs. 2 . take ( ) . unwrap ( ) ;
5148
+ assert_eq ! ( commitment_update. commitment_signed. len( ) , 1 ) ;
5149
+ node_b. node . handle_commitment_signed_batch_test (
5150
+ node_a_id,
5151
+ & commitment_update. commitment_signed ,
5152
+ )
5153
+ }
5154
+ if send_interactive_tx_sigs. 1 {
5155
+ let tx_signatures = chan_msgs. 5 . take ( ) . unwrap ( ) ;
5156
+ node_b. node . handle_tx_signatures ( node_a_id, & tx_signatures) ;
5157
+ } else {
5158
+ assert ! ( chan_msgs. 5 . is_none( ) ) ;
5159
+ }
5105
5160
if pending_raa. 1 {
5106
5161
assert ! ( chan_msgs. 3 == RAACommitmentOrder :: RevokeAndACKFirst ) ;
5107
5162
node_b. node . handle_revoke_and_ack ( node_a_id, & chan_msgs. 1 . unwrap ( ) ) ;
0 commit comments