@@ -4741,11 +4741,14 @@ macro_rules! handle_chan_reestablish_msgs {
4741
4741
None
4742
4742
} ;
4743
4743
4744
- if let Some ( & MessageSendEvent :: SendAnnouncementSignatures { ref node_id, msg: _ } ) =
4744
+ let mut announcement_sigs = None ; // May be now or later
4745
+ if let Some ( & MessageSendEvent :: SendAnnouncementSignatures { ref node_id, ref msg } ) =
4745
4746
msg_events. get( idx)
4746
4747
{
4747
4748
idx += 1 ;
4748
4749
assert_eq!( * node_id, $dst_node. node. get_our_node_id( ) ) ;
4750
+ assert!( announcement_sigs. is_none( ) ) ;
4751
+ announcement_sigs = Some ( msg. clone( ) ) ;
4749
4752
}
4750
4753
4751
4754
let mut had_channel_update = false ; // ChannelUpdate may be now or later, but not both
@@ -4811,16 +4814,26 @@ macro_rules! handle_chan_reestablish_msgs {
4811
4814
assert!( !had_channel_update) ;
4812
4815
}
4813
4816
4814
- assert_eq!( msg_events. len( ) , idx) ;
4817
+ if let Some ( & MessageSendEvent :: SendAnnouncementSignatures { ref node_id, ref msg } ) =
4818
+ msg_events. get( idx)
4819
+ {
4820
+ idx += 1 ;
4821
+ assert_eq!( * node_id, $dst_node. node. get_our_node_id( ) ) ;
4822
+ assert!( announcement_sigs. is_none( ) ) ;
4823
+ announcement_sigs = Some ( msg. clone( ) ) ;
4824
+ }
4825
+
4826
+ assert_eq!( msg_events. len( ) , idx, "{msg_events:?}" ) ;
4815
4827
4816
- ( channel_ready, revoke_and_ack, commitment_update, order)
4828
+ ( channel_ready, revoke_and_ack, commitment_update, order, announcement_sigs )
4817
4829
} } ;
4818
4830
}
4819
4831
4820
4832
pub struct ReconnectArgs < ' a , ' b , ' c , ' d > {
4821
4833
pub node_a : & ' a Node < ' b , ' c , ' d > ,
4822
4834
pub node_b : & ' a Node < ' b , ' c , ' d > ,
4823
4835
pub send_channel_ready : ( bool , bool ) ,
4836
+ pub send_announcement_sigs : ( bool , bool ) ,
4824
4837
pub pending_responding_commitment_signed : ( bool , bool ) ,
4825
4838
/// Indicates that the pending responding commitment signed will be a dup for the recipient,
4826
4839
/// and no monitor update is expected
@@ -4839,6 +4852,7 @@ impl<'a, 'b, 'c, 'd> ReconnectArgs<'a, 'b, 'c, 'd> {
4839
4852
node_a,
4840
4853
node_b,
4841
4854
send_channel_ready : ( false , false ) ,
4855
+ send_announcement_sigs : ( false , false ) ,
4842
4856
pending_responding_commitment_signed : ( false , false ) ,
4843
4857
pending_responding_commitment_signed_dup_monitor : ( false , false ) ,
4844
4858
pending_htlc_adds : ( 0 , 0 ) ,
@@ -4858,6 +4872,7 @@ pub fn reconnect_nodes<'a, 'b, 'c, 'd>(args: ReconnectArgs<'a, 'b, 'c, 'd>) {
4858
4872
node_a,
4859
4873
node_b,
4860
4874
send_channel_ready,
4875
+ send_announcement_sigs,
4861
4876
pending_htlc_adds,
4862
4877
pending_htlc_claims,
4863
4878
pending_htlc_fails,
@@ -4939,7 +4954,7 @@ pub fn reconnect_nodes<'a, 'b, 'c, 'd>(args: ReconnectArgs<'a, 'b, 'c, 'd>) {
4939
4954
&& pending_cell_htlc_fails. 1 == 0 )
4940
4955
) ;
4941
4956
4942
- for chan_msgs in resp_1. drain ( ..) {
4957
+ for mut chan_msgs in resp_1. drain ( ..) {
4943
4958
if send_channel_ready. 0 {
4944
4959
node_a. node . handle_channel_ready ( node_b_id, & chan_msgs. 0 . unwrap ( ) ) ;
4945
4960
let announcement_event = node_a. node . get_and_clear_pending_msg_events ( ) ;
@@ -4954,6 +4969,18 @@ pub fn reconnect_nodes<'a, 'b, 'c, 'd>(args: ReconnectArgs<'a, 'b, 'c, 'd>) {
4954
4969
} else {
4955
4970
assert ! ( chan_msgs. 0 . is_none( ) ) ;
4956
4971
}
4972
+ if send_announcement_sigs. 0 {
4973
+ let announcement_sigs = chan_msgs. 4 . take ( ) . unwrap ( ) ;
4974
+ node_a. node . handle_announcement_signatures ( node_b_id, & announcement_sigs) ;
4975
+ let msg_events = node_a. node . get_and_clear_pending_msg_events ( ) ;
4976
+ assert_eq ! ( msg_events. len( ) , 1 , "{msg_events:?}" ) ;
4977
+ if let MessageSendEvent :: BroadcastChannelAnnouncement { .. } = msg_events[ 0 ] {
4978
+ } else {
4979
+ panic ! ( "Unexpected event! {:?}" , msg_events[ 0 ] ) ;
4980
+ }
4981
+ } else {
4982
+ assert ! ( chan_msgs. 4 . is_none( ) ) ;
4983
+ }
4957
4984
if pending_raa. 0 {
4958
4985
assert ! ( chan_msgs. 3 == RAACommitmentOrder :: RevokeAndACKFirst ) ;
4959
4986
node_a. node . handle_revoke_and_ack ( node_b_id, & chan_msgs. 1 . unwrap ( ) ) ;
@@ -5018,7 +5045,7 @@ pub fn reconnect_nodes<'a, 'b, 'c, 'd>(args: ReconnectArgs<'a, 'b, 'c, 'd>) {
5018
5045
}
5019
5046
}
5020
5047
5021
- for chan_msgs in resp_2. drain ( ..) {
5048
+ for mut chan_msgs in resp_2. drain ( ..) {
5022
5049
if send_channel_ready. 1 {
5023
5050
node_b. node . handle_channel_ready ( node_a_id, & chan_msgs. 0 . unwrap ( ) ) ;
5024
5051
let announcement_event = node_b. node . get_and_clear_pending_msg_events ( ) ;
@@ -5033,6 +5060,18 @@ pub fn reconnect_nodes<'a, 'b, 'c, 'd>(args: ReconnectArgs<'a, 'b, 'c, 'd>) {
5033
5060
} else {
5034
5061
assert ! ( chan_msgs. 0 . is_none( ) ) ;
5035
5062
}
5063
+ if send_announcement_sigs. 1 {
5064
+ let announcement_sigs = chan_msgs. 4 . take ( ) . unwrap ( ) ;
5065
+ node_b. node . handle_announcement_signatures ( node_a_id, & announcement_sigs) ;
5066
+ let mut msg_events = node_b. node . get_and_clear_pending_msg_events ( ) ;
5067
+ assert_eq ! ( msg_events. len( ) , 1 , "{msg_events:?}" ) ;
5068
+ if let MessageSendEvent :: BroadcastChannelAnnouncement { .. } = msg_events. remove ( 0 ) {
5069
+ } else {
5070
+ panic ! ( ) ;
5071
+ }
5072
+ } else {
5073
+ assert ! ( chan_msgs. 4 . is_none( ) ) ;
5074
+ }
5036
5075
if pending_raa. 1 {
5037
5076
assert ! ( chan_msgs. 3 == RAACommitmentOrder :: RevokeAndACKFirst ) ;
5038
5077
node_b. node . handle_revoke_and_ack ( node_a_id, & chan_msgs. 1 . unwrap ( ) ) ;
0 commit comments