@@ -339,6 +339,7 @@ struct Peer {
339339 msgs_sent_since_pong : usize ,
340340 awaiting_pong_timer_tick_intervals : i8 ,
341341 received_message_since_timer_tick : bool ,
342+ sent_gossip_timestamp_filter : bool ,
342343}
343344
344345impl Peer {
@@ -348,7 +349,11 @@ impl Peer {
348349 /// announcements/updates for the given channel_id then we will send it when we get to that
349350 /// point and we shouldn't send it yet to avoid sending duplicate updates. If we've already
350351 /// sent the old versions, we should send the update, and so return true here.
351- fn should_forward_channel_announcement ( & self , channel_id : u64 ) ->bool {
352+ fn should_forward_channel_announcement ( & self , channel_id : u64 ) -> bool {
353+ if self . their_features . as_ref ( ) . unwrap ( ) . supports_gossip_queries ( ) &&
354+ !self . sent_gossip_timestamp_filter {
355+ return false ;
356+ }
352357 match self . sync_status {
353358 InitSyncTracker :: NoSyncRequested => true ,
354359 InitSyncTracker :: ChannelsSyncing ( i) => i < channel_id,
@@ -358,6 +363,10 @@ impl Peer {
358363
359364 /// Similar to the above, but for node announcements indexed by node_id.
360365 fn should_forward_node_announcement ( & self , node_id : PublicKey ) -> bool {
366+ if self . their_features . as_ref ( ) . unwrap ( ) . supports_gossip_queries ( ) &&
367+ !self . sent_gossip_timestamp_filter {
368+ return false ;
369+ }
361370 match self . sync_status {
362371 InitSyncTracker :: NoSyncRequested => true ,
363372 InitSyncTracker :: ChannelsSyncing ( _) => false ,
@@ -619,6 +628,7 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref, CMH: Deref> P
619628 msgs_sent_since_pong : 0 ,
620629 awaiting_pong_timer_tick_intervals : 0 ,
621630 received_message_since_timer_tick : false ,
631+ sent_gossip_timestamp_filter : false ,
622632 } ) . is_some ( ) {
623633 panic ! ( "PeerManager driver duplicated descriptors!" ) ;
624634 } ;
@@ -665,6 +675,7 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref, CMH: Deref> P
665675 msgs_sent_since_pong : 0 ,
666676 awaiting_pong_timer_tick_intervals : 0 ,
667677 received_message_since_timer_tick : false ,
678+ sent_gossip_timestamp_filter : false ,
668679 } ) . is_some ( ) {
669680 panic ! ( "PeerManager driver duplicated descriptors!" ) ;
670681 } ;
@@ -1058,7 +1069,7 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref, CMH: Deref> P
10581069
10591070 log_info ! ( self . logger, "Received peer Init message from {}: {}" , log_pubkey!( peer. their_node_id. unwrap( ) ) , msg. features) ;
10601071
1061- if msg. features . initial_routing_sync ( ) {
1072+ if msg. features . initial_routing_sync ( ) && !msg . features . supports_gossip_queries ( ) {
10621073 peer. sync_status = InitSyncTracker :: ChannelsSyncing ( 0 ) ;
10631074 }
10641075 if !msg. features . supports_static_remote_key ( ) {
@@ -1205,7 +1216,13 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref, CMH: Deref> P
12051216 self . message_handler . route_handler . handle_reply_channel_range ( & peer. their_node_id . unwrap ( ) , msg) ?;
12061217 } ,
12071218 wire:: Message :: GossipTimestampFilter ( _msg) => {
1208- // TODO: handle message
1219+ // When supporting gossip messages, start inital gossip sync only after we receive
1220+ // a GossipTimestampFilter
1221+ if peer. their_features . as_ref ( ) . unwrap ( ) . supports_gossip_queries ( ) &&
1222+ !peer. sent_gossip_timestamp_filter {
1223+ peer. sent_gossip_timestamp_filter = true ;
1224+ peer. sync_status = InitSyncTracker :: ChannelsSyncing ( 0 ) ;
1225+ }
12091226 } ,
12101227
12111228 // Unknown messages:
0 commit comments