@@ -1730,23 +1730,26 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, OM: Deref, L: Deref, CM
17301730 return Err ( PeerHandleError { } . into ( ) ) ;
17311731 }
17321732
1733- if let wire:: Message :: GossipTimestampFilter ( msg ) = message {
1733+ if let wire:: Message :: GossipTimestampFilter ( _msg ) = message {
17341734 // When supporting gossip messages, start initial gossip sync only after we receive
17351735 // a GossipTimestampFilter
17361736 if peer_lock. their_features . as_ref ( ) . unwrap ( ) . supports_gossip_queries ( ) &&
17371737 !peer_lock. sent_gossip_timestamp_filter {
17381738 peer_lock. sent_gossip_timestamp_filter = true ;
17391739
1740- #[ allow( unused_mut, unused_assignments ) ]
1741- let mut full_sync_threshold = 0 ;
1740+ #[ allow( unused_mut) ]
1741+ let mut should_do_full_sync = true ;
17421742 #[ cfg( feature = "std" ) ]
17431743 {
17441744 // if the timestamp range starts more than six hours ago, do a full sync
1745- // otherwise, start at the current time
1745+ // otherwise, only forward ad-hoc gossip
17461746 use std:: time:: { SystemTime , UNIX_EPOCH } ;
1747- full_sync_threshold = SystemTime :: now ( ) . duration_since ( UNIX_EPOCH ) . expect ( "Time must be > 1970" ) . as_secs ( ) - 6 * 3600 ;
1747+ let full_sync_threshold = SystemTime :: now ( ) . duration_since ( UNIX_EPOCH ) . expect ( "Time must be > 1970" ) . as_secs ( ) - 6 * 3600 ;
1748+ if ( _msg. first_timestamp as u64 ) > full_sync_threshold {
1749+ should_do_full_sync = false ;
1750+ }
17481751 }
1749- if ( msg . first_timestamp as u64 ) <= full_sync_threshold {
1752+ if should_do_full_sync {
17501753 peer_lock. sync_status = InitSyncTracker :: ChannelsSyncing ( 0 ) ;
17511754 }
17521755 }
0 commit comments