@@ -4862,6 +4862,15 @@ macro_rules! handle_chan_reestablish_msgs {
4862
4862
}
4863
4863
}
4864
4864
4865
+ let mut tx_signatures = None ;
4866
+ if let Some ( & MessageSendEvent :: SendTxSignatures { ref node_id, ref msg } ) =
4867
+ msg_events. get( idx)
4868
+ {
4869
+ assert_eq!( * node_id, $dst_node. node. get_our_node_id( ) ) ;
4870
+ tx_signatures = Some ( msg. clone( ) ) ;
4871
+ idx += 1 ;
4872
+ }
4873
+
4865
4874
if let Some ( & MessageSendEvent :: SendAnnouncementSignatures { ref node_id, ref msg } ) =
4866
4875
msg_events. get( idx)
4867
4876
{
@@ -4880,7 +4889,7 @@ macro_rules! handle_chan_reestablish_msgs {
4880
4889
4881
4890
assert_eq!( msg_events. len( ) , idx, "{msg_events:?}" ) ;
4882
4891
4883
- ( channel_ready, revoke_and_ack, commitment_update, order, announcement_sigs)
4892
+ ( channel_ready, revoke_and_ack, commitment_update, order, announcement_sigs, tx_signatures )
4884
4893
} } ;
4885
4894
}
4886
4895
@@ -4889,6 +4898,9 @@ pub struct ReconnectArgs<'a, 'b, 'c, 'd> {
4889
4898
pub node_b : & ' a Node < ' b , ' c , ' d > ,
4890
4899
pub send_channel_ready : ( bool , bool ) ,
4891
4900
pub send_announcement_sigs : ( bool , bool ) ,
4901
+ pub send_interactive_tx_commit_sig : ( bool , bool ) ,
4902
+ pub send_interactive_tx_sigs : ( bool , bool ) ,
4903
+ pub expect_renegotiated_funding_locked_monitor_update : ( bool , bool ) ,
4892
4904
pub pending_responding_commitment_signed : ( bool , bool ) ,
4893
4905
/// Indicates that the pending responding commitment signed will be a dup for the recipient,
4894
4906
/// and no monitor update is expected
@@ -4908,6 +4920,9 @@ impl<'a, 'b, 'c, 'd> ReconnectArgs<'a, 'b, 'c, 'd> {
4908
4920
node_b,
4909
4921
send_channel_ready : ( false , false ) ,
4910
4922
send_announcement_sigs : ( false , false ) ,
4923
+ send_interactive_tx_commit_sig : ( false , false ) ,
4924
+ send_interactive_tx_sigs : ( false , false ) ,
4925
+ expect_renegotiated_funding_locked_monitor_update : ( false , false ) ,
4911
4926
pending_responding_commitment_signed : ( false , false ) ,
4912
4927
pending_responding_commitment_signed_dup_monitor : ( false , false ) ,
4913
4928
pending_htlc_adds : ( 0 , 0 ) ,
@@ -4928,6 +4943,9 @@ pub fn reconnect_nodes<'a, 'b, 'c, 'd>(args: ReconnectArgs<'a, 'b, 'c, 'd>) {
4928
4943
node_b,
4929
4944
send_channel_ready,
4930
4945
send_announcement_sigs,
4946
+ send_interactive_tx_commit_sig,
4947
+ send_interactive_tx_sigs,
4948
+ expect_renegotiated_funding_locked_monitor_update,
4931
4949
pending_htlc_adds,
4932
4950
pending_htlc_claims,
4933
4951
pending_htlc_fails,
@@ -4978,7 +4996,11 @@ pub fn reconnect_nodes<'a, 'b, 'c, 'd>(args: ReconnectArgs<'a, 'b, 'c, 'd>) {
4978
4996
node_b. node . handle_channel_reestablish ( node_a_id, & msg) ;
4979
4997
resp_1. push ( handle_chan_reestablish_msgs ! ( node_b, node_a) ) ;
4980
4998
}
4981
- if pending_cell_htlc_claims. 0 != 0 || pending_cell_htlc_fails. 0 != 0 {
4999
+
5000
+ if pending_cell_htlc_claims. 0 != 0
5001
+ || pending_cell_htlc_fails. 0 != 0
5002
+ || expect_renegotiated_funding_locked_monitor_update. 1
5003
+ {
4982
5004
check_added_monitors ! ( node_b, 1 ) ;
4983
5005
} else {
4984
5006
check_added_monitors ! ( node_b, 0 ) ;
@@ -4989,7 +5011,10 @@ pub fn reconnect_nodes<'a, 'b, 'c, 'd>(args: ReconnectArgs<'a, 'b, 'c, 'd>) {
4989
5011
node_a. node . handle_channel_reestablish ( node_b_id, & msg) ;
4990
5012
resp_2. push ( handle_chan_reestablish_msgs ! ( node_a, node_b) ) ;
4991
5013
}
4992
- if pending_cell_htlc_claims. 1 != 0 || pending_cell_htlc_fails. 1 != 0 {
5014
+ if pending_cell_htlc_claims. 1 != 0
5015
+ || pending_cell_htlc_fails. 1 != 0
5016
+ || expect_renegotiated_funding_locked_monitor_update. 0
5017
+ {
4993
5018
check_added_monitors ! ( node_a, 1 ) ;
4994
5019
} else {
4995
5020
check_added_monitors ! ( node_a, 0 ) ;
@@ -5036,6 +5061,21 @@ pub fn reconnect_nodes<'a, 'b, 'c, 'd>(args: ReconnectArgs<'a, 'b, 'c, 'd>) {
5036
5061
} else {
5037
5062
assert ! ( chan_msgs. 4 . is_none( ) ) ;
5038
5063
}
5064
+ if send_interactive_tx_commit_sig. 0 {
5065
+ assert ! ( chan_msgs. 1 . is_none( ) ) ;
5066
+ let commitment_update = chan_msgs. 2 . take ( ) . unwrap ( ) ;
5067
+ assert_eq ! ( commitment_update. commitment_signed. len( ) , 1 ) ;
5068
+ node_a. node . handle_commitment_signed_batch_test (
5069
+ node_b_id,
5070
+ & commitment_update. commitment_signed ,
5071
+ )
5072
+ }
5073
+ if send_interactive_tx_sigs. 0 {
5074
+ let tx_signatures = chan_msgs. 5 . take ( ) . unwrap ( ) ;
5075
+ node_a. node . handle_tx_signatures ( node_b_id, & tx_signatures) ;
5076
+ } else {
5077
+ assert ! ( chan_msgs. 5 . is_none( ) ) ;
5078
+ }
5039
5079
if pending_raa. 0 {
5040
5080
assert ! ( chan_msgs. 3 == RAACommitmentOrder :: RevokeAndACKFirst ) ;
5041
5081
node_a. node . handle_revoke_and_ack ( node_b_id, & chan_msgs. 1 . unwrap ( ) ) ;
@@ -5127,6 +5167,21 @@ pub fn reconnect_nodes<'a, 'b, 'c, 'd>(args: ReconnectArgs<'a, 'b, 'c, 'd>) {
5127
5167
} else {
5128
5168
assert ! ( chan_msgs. 4 . is_none( ) ) ;
5129
5169
}
5170
+ if send_interactive_tx_commit_sig. 1 {
5171
+ assert ! ( chan_msgs. 1 . is_none( ) ) ;
5172
+ let commitment_update = chan_msgs. 2 . take ( ) . unwrap ( ) ;
5173
+ assert_eq ! ( commitment_update. commitment_signed. len( ) , 1 ) ;
5174
+ node_b. node . handle_commitment_signed_batch_test (
5175
+ node_a_id,
5176
+ & commitment_update. commitment_signed ,
5177
+ )
5178
+ }
5179
+ if send_interactive_tx_sigs. 1 {
5180
+ let tx_signatures = chan_msgs. 5 . take ( ) . unwrap ( ) ;
5181
+ node_b. node . handle_tx_signatures ( node_a_id, & tx_signatures) ;
5182
+ } else {
5183
+ assert ! ( chan_msgs. 5 . is_none( ) ) ;
5184
+ }
5130
5185
if pending_raa. 1 {
5131
5186
assert ! ( chan_msgs. 3 == RAACommitmentOrder :: RevokeAndACKFirst ) ;
5132
5187
node_b. node . handle_revoke_and_ack ( node_a_id, & chan_msgs. 1 . unwrap ( ) ) ;
0 commit comments