@@ -355,10 +355,14 @@ impl<Descriptor: SocketDescriptor, CM: Deref> PeerManager<Descriptor, CM> where
355
355
InitSyncTracker :: ChannelsSyncing ( c) if c < 0xffff_ffff_ffff_ffff => {
356
356
let steps = ( ( MSG_BUFF_SIZE - peer. pending_outbound_buffer . len ( ) + 2 ) / 3 ) as u8 ;
357
357
let all_messages = self . message_handler . route_handler . get_next_channel_announcements ( c, steps) ;
358
- for & ( ref announce, ref update_a , ref update_b ) in all_messages. iter ( ) {
358
+ for & ( ref announce, ref update_a_option , ref update_b_option ) in all_messages. iter ( ) {
359
359
encode_and_send_msg ! ( announce) ;
360
- encode_and_send_msg ! ( update_a) ;
361
- encode_and_send_msg ! ( update_b) ;
360
+ if let & Some ( ref update_a) = update_a_option {
361
+ encode_and_send_msg ! ( update_a) ;
362
+ }
363
+ if let & Some ( ref update_b) = update_b_option {
364
+ encode_and_send_msg ! ( update_b) ;
365
+ }
362
366
peer. sync_status = InitSyncTracker :: ChannelsSyncing ( announce. contents . short_channel_id + 1 ) ;
363
367
}
364
368
if all_messages. is_empty ( ) || all_messages. len ( ) != steps as usize {
@@ -1313,7 +1317,7 @@ mod tests {
1313
1317
Err ( msgs:: LightningError { err : "" , action : msgs:: ErrorAction :: IgnoreError } )
1314
1318
}
1315
1319
fn handle_htlc_fail_channel_update ( & self , _update : & msgs:: HTLCFailChannelUpdate ) { }
1316
- fn get_next_channel_announcements ( & self , starting_point : u64 , batch_amount : u8 ) -> Vec < ( msgs:: ChannelAnnouncement , msgs:: ChannelUpdate , msgs:: ChannelUpdate ) > {
1320
+ fn get_next_channel_announcements ( & self , starting_point : u64 , batch_amount : u8 ) -> Vec < ( msgs:: ChannelAnnouncement , Option < msgs:: ChannelUpdate > , Option < msgs:: ChannelUpdate > ) > {
1317
1321
let mut chan_anns = Vec :: new ( ) ;
1318
1322
const TOTAL_UPDS : u64 = 100 ;
1319
1323
let end: u64 = min ( starting_point + batch_amount as u64 , TOTAL_UPDS - self . chan_anns_sent . load ( Ordering :: Acquire ) as u64 ) ;
@@ -1322,7 +1326,7 @@ mod tests {
1322
1326
let chan_upd_2 = get_dummy_channel_update ( i) ;
1323
1327
let chan_ann = get_dummy_channel_announcement ( i) ;
1324
1328
1325
- chan_anns. push ( ( chan_ann, chan_upd_1, chan_upd_2) ) ;
1329
+ chan_anns. push ( ( chan_ann, Some ( chan_upd_1) , Some ( chan_upd_2) ) ) ;
1326
1330
}
1327
1331
1328
1332
self . chan_anns_sent . fetch_add ( chan_anns. len ( ) , Ordering :: AcqRel ) ;
0 commit comments