@@ -4807,6 +4807,15 @@ macro_rules! handle_chan_reestablish_msgs {
4807
4807
}
4808
4808
}
4809
4809
4810
+ let mut tx_signatures = None ;
4811
+ if let Some ( & MessageSendEvent :: SendTxSignatures { ref node_id, ref msg } ) =
4812
+ msg_events. get( idx)
4813
+ {
4814
+ assert_eq!( * node_id, $dst_node. node. get_our_node_id( ) ) ;
4815
+ tx_signatures = Some ( msg. clone( ) ) ;
4816
+ idx += 1 ;
4817
+ }
4818
+
4810
4819
if let Some ( & MessageSendEvent :: SendChannelUpdate { ref node_id, .. } ) = msg_events. get( idx)
4811
4820
{
4812
4821
assert_eq!( * node_id, $dst_node. node. get_our_node_id( ) ) ;
@@ -4825,7 +4834,7 @@ macro_rules! handle_chan_reestablish_msgs {
4825
4834
4826
4835
assert_eq!( msg_events. len( ) , idx, "{msg_events:?}" ) ;
4827
4836
4828
- ( channel_ready, revoke_and_ack, commitment_update, order, announcement_sigs)
4837
+ ( channel_ready, revoke_and_ack, commitment_update, order, announcement_sigs, tx_signatures )
4829
4838
} } ;
4830
4839
}
4831
4840
@@ -4834,6 +4843,9 @@ pub struct ReconnectArgs<'a, 'b, 'c, 'd> {
4834
4843
pub node_b : & ' a Node < ' b , ' c , ' d > ,
4835
4844
pub send_channel_ready : ( bool , bool ) ,
4836
4845
pub send_announcement_sigs : ( bool , bool ) ,
4846
+ pub send_interactive_tx_commit_sig : ( bool , bool ) ,
4847
+ pub send_interactive_tx_sigs : ( bool , bool ) ,
4848
+ pub expect_renegotiated_funding_locked_monitor_update : ( bool , bool ) ,
4837
4849
pub pending_responding_commitment_signed : ( bool , bool ) ,
4838
4850
/// Indicates that the pending responding commitment signed will be a dup for the recipient,
4839
4851
/// and no monitor update is expected
@@ -4853,6 +4865,9 @@ impl<'a, 'b, 'c, 'd> ReconnectArgs<'a, 'b, 'c, 'd> {
4853
4865
node_b,
4854
4866
send_channel_ready : ( false , false ) ,
4855
4867
send_announcement_sigs : ( false , false ) ,
4868
+ send_interactive_tx_commit_sig : ( false , false ) ,
4869
+ send_interactive_tx_sigs : ( false , false ) ,
4870
+ expect_renegotiated_funding_locked_monitor_update : ( false , false ) ,
4856
4871
pending_responding_commitment_signed : ( false , false ) ,
4857
4872
pending_responding_commitment_signed_dup_monitor : ( false , false ) ,
4858
4873
pending_htlc_adds : ( 0 , 0 ) ,
@@ -4873,6 +4888,9 @@ pub fn reconnect_nodes<'a, 'b, 'c, 'd>(args: ReconnectArgs<'a, 'b, 'c, 'd>) {
4873
4888
node_b,
4874
4889
send_channel_ready,
4875
4890
send_announcement_sigs,
4891
+ send_interactive_tx_commit_sig,
4892
+ send_interactive_tx_sigs,
4893
+ expect_renegotiated_funding_locked_monitor_update,
4876
4894
pending_htlc_adds,
4877
4895
pending_htlc_claims,
4878
4896
pending_htlc_fails,
@@ -4923,7 +4941,11 @@ pub fn reconnect_nodes<'a, 'b, 'c, 'd>(args: ReconnectArgs<'a, 'b, 'c, 'd>) {
4923
4941
node_b. node . handle_channel_reestablish ( node_a_id, & msg) ;
4924
4942
resp_1. push ( handle_chan_reestablish_msgs ! ( node_b, node_a) ) ;
4925
4943
}
4926
- if pending_cell_htlc_claims. 0 != 0 || pending_cell_htlc_fails. 0 != 0 {
4944
+
4945
+ if pending_cell_htlc_claims. 0 != 0
4946
+ || pending_cell_htlc_fails. 0 != 0
4947
+ || expect_renegotiated_funding_locked_monitor_update. 1
4948
+ {
4927
4949
check_added_monitors ! ( node_b, 1 ) ;
4928
4950
} else {
4929
4951
check_added_monitors ! ( node_b, 0 ) ;
@@ -4934,7 +4956,10 @@ pub fn reconnect_nodes<'a, 'b, 'c, 'd>(args: ReconnectArgs<'a, 'b, 'c, 'd>) {
4934
4956
node_a. node . handle_channel_reestablish ( node_b_id, & msg) ;
4935
4957
resp_2. push ( handle_chan_reestablish_msgs ! ( node_a, node_b) ) ;
4936
4958
}
4937
- if pending_cell_htlc_claims. 1 != 0 || pending_cell_htlc_fails. 1 != 0 {
4959
+ if pending_cell_htlc_claims. 1 != 0
4960
+ || pending_cell_htlc_fails. 1 != 0
4961
+ || expect_renegotiated_funding_locked_monitor_update. 0
4962
+ {
4938
4963
check_added_monitors ! ( node_a, 1 ) ;
4939
4964
} else {
4940
4965
check_added_monitors ! ( node_a, 0 ) ;
@@ -4981,6 +5006,21 @@ pub fn reconnect_nodes<'a, 'b, 'c, 'd>(args: ReconnectArgs<'a, 'b, 'c, 'd>) {
4981
5006
} else {
4982
5007
assert ! ( chan_msgs. 4 . is_none( ) ) ;
4983
5008
}
5009
+ if send_interactive_tx_commit_sig. 0 {
5010
+ assert ! ( chan_msgs. 1 . is_none( ) ) ;
5011
+ let commitment_update = chan_msgs. 2 . take ( ) . unwrap ( ) ;
5012
+ assert_eq ! ( commitment_update. commitment_signed. len( ) , 1 ) ;
5013
+ node_a. node . handle_commitment_signed_batch_test (
5014
+ node_b_id,
5015
+ & commitment_update. commitment_signed ,
5016
+ )
5017
+ }
5018
+ if send_interactive_tx_sigs. 0 {
5019
+ let tx_signatures = chan_msgs. 5 . take ( ) . unwrap ( ) ;
5020
+ node_a. node . handle_tx_signatures ( node_b_id, & tx_signatures) ;
5021
+ } else {
5022
+ assert ! ( chan_msgs. 5 . is_none( ) ) ;
5023
+ }
4984
5024
if pending_raa. 0 {
4985
5025
assert ! ( chan_msgs. 3 == RAACommitmentOrder :: RevokeAndACKFirst ) ;
4986
5026
node_a. node . handle_revoke_and_ack ( node_b_id, & chan_msgs. 1 . unwrap ( ) ) ;
@@ -5072,6 +5112,21 @@ pub fn reconnect_nodes<'a, 'b, 'c, 'd>(args: ReconnectArgs<'a, 'b, 'c, 'd>) {
5072
5112
} else {
5073
5113
assert ! ( chan_msgs. 4 . is_none( ) ) ;
5074
5114
}
5115
+ if send_interactive_tx_commit_sig. 1 {
5116
+ assert ! ( chan_msgs. 1 . is_none( ) ) ;
5117
+ let commitment_update = chan_msgs. 2 . take ( ) . unwrap ( ) ;
5118
+ assert_eq ! ( commitment_update. commitment_signed. len( ) , 1 ) ;
5119
+ node_b. node . handle_commitment_signed_batch_test (
5120
+ node_a_id,
5121
+ & commitment_update. commitment_signed ,
5122
+ )
5123
+ }
5124
+ if send_interactive_tx_sigs. 1 {
5125
+ let tx_signatures = chan_msgs. 5 . take ( ) . unwrap ( ) ;
5126
+ node_b. node . handle_tx_signatures ( node_a_id, & tx_signatures) ;
5127
+ } else {
5128
+ assert ! ( chan_msgs. 5 . is_none( ) ) ;
5129
+ }
5075
5130
if pending_raa. 1 {
5076
5131
assert ! ( chan_msgs. 3 == RAACommitmentOrder :: RevokeAndACKFirst ) ;
5077
5132
node_b. node . handle_revoke_and_ack ( node_a_id, & chan_msgs. 1 . unwrap ( ) ) ;
0 commit comments