@@ -71,7 +71,7 @@ impl RoutingMessageHandler for IgnoringMessageHandler {
71
71
fn handle_channel_update ( & self , _msg : & msgs:: ChannelUpdate ) -> Result < bool , LightningError > { Ok ( false ) }
72
72
fn get_next_channel_announcement ( & self , _starting_point : u64 ) ->
73
73
Option < ( msgs:: ChannelAnnouncement , Option < msgs:: ChannelUpdate > , Option < msgs:: ChannelUpdate > ) > { None }
74
- fn get_next_node_announcement ( & self , _starting_point : Option < & PublicKey > ) -> Option < msgs:: NodeAnnouncement > { None }
74
+ fn get_next_node_announcement ( & self , _starting_point : Option < & NodeId > ) -> Option < msgs:: NodeAnnouncement > { None }
75
75
fn peer_connected ( & self , _their_node_id : & PublicKey , _init : & msgs:: Init ) -> Result < ( ) , ( ) > { Ok ( ( ) ) }
76
76
fn handle_reply_channel_range ( & self , _their_node_id : & PublicKey , _msg : msgs:: ReplyChannelRange ) -> Result < ( ) , LightningError > { Ok ( ( ) ) }
77
77
fn handle_reply_short_channel_ids_end ( & self , _their_node_id : & PublicKey , _msg : msgs:: ReplyShortChannelIdsEnd ) -> Result < ( ) , LightningError > { Ok ( ( ) ) }
@@ -345,7 +345,7 @@ impl error::Error for PeerHandleError {
345
345
enum InitSyncTracker {
346
346
NoSyncRequested ,
347
347
ChannelsSyncing ( u64 ) ,
348
- NodesSyncing ( PublicKey ) ,
348
+ NodesSyncing ( NodeId ) ,
349
349
}
350
350
351
351
/// The ratio between buffer sizes at which we stop sending initial sync messages vs when we stop
@@ -434,15 +434,15 @@ impl Peer {
434
434
}
435
435
436
436
/// Similar to the above, but for node announcements indexed by node_id.
437
- fn should_forward_node_announcement ( & self , node_id : PublicKey ) -> bool {
437
+ fn should_forward_node_announcement ( & self , node_id : NodeId ) -> bool {
438
438
if self . their_features . as_ref ( ) . unwrap ( ) . supports_gossip_queries ( ) &&
439
439
!self . sent_gossip_timestamp_filter {
440
440
return false ;
441
441
}
442
442
match self . sync_status {
443
443
InitSyncTracker :: NoSyncRequested => true ,
444
444
InitSyncTracker :: ChannelsSyncing ( _) => false ,
445
- InitSyncTracker :: NodesSyncing ( pk ) => pk < node_id,
445
+ InitSyncTracker :: NodesSyncing ( sync_node_id ) => sync_node_id . as_slice ( ) < node_id. as_slice ( ) ,
446
446
}
447
447
}
448
448
@@ -889,8 +889,8 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, OM: Deref, L: Deref, CM
889
889
}
890
890
} ,
891
891
InitSyncTracker :: ChannelsSyncing ( _) => unreachable ! ( ) ,
892
- InitSyncTracker :: NodesSyncing ( key ) => {
893
- if let Some ( msg) = self . message_handler . route_handler . get_next_node_announcement ( Some ( & key ) ) {
892
+ InitSyncTracker :: NodesSyncing ( sync_node_id ) => {
893
+ if let Some ( msg) = self . message_handler . route_handler . get_next_node_announcement ( Some ( & sync_node_id ) ) {
894
894
self . enqueue_message ( peer, & msg) ;
895
895
peer. sync_status = InitSyncTracker :: NodesSyncing ( msg. contents . node_id ) ;
896
896
} else {
@@ -1493,8 +1493,10 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, OM: Deref, L: Deref, CM
1493
1493
log_gossip ! ( self . logger, "Skipping broadcast message to {:?} as its outbound buffer is full" , peer. their_node_id) ;
1494
1494
continue ;
1495
1495
}
1496
- if peer. their_node_id . as_ref ( ) == Some ( & msg. contents . node_id ) {
1497
- continue ;
1496
+ if let Some ( their_node_id) = peer. their_node_id {
1497
+ if NodeId :: from_pubkey ( & their_node_id) == msg. contents . node_id {
1498
+ continue ;
1499
+ }
1498
1500
}
1499
1501
if except_node. is_some ( ) && peer. their_node_id . as_ref ( ) == except_node {
1500
1502
continue ;
@@ -2023,7 +2025,7 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, OM: Deref, L: Deref, CM
2023
2025
let announcement = msgs:: UnsignedNodeAnnouncement {
2024
2026
features,
2025
2027
timestamp : self . last_node_announcement_serial . fetch_add ( 1 , Ordering :: AcqRel ) ,
2026
- node_id : self . node_signer . get_node_id ( Recipient :: Node ) . unwrap ( ) ,
2028
+ node_id : NodeId :: from_pubkey ( & self . node_signer . get_node_id ( Recipient :: Node ) . unwrap ( ) ) ,
2027
2029
rgb, alias, addresses,
2028
2030
excess_address_data : Vec :: new ( ) ,
2029
2031
excess_data : Vec :: new ( ) ,
0 commit comments