Skip to content

Commit e5f9a11

Browse files
committed
f: Move threshold check inside filter verification check
1 parent 3854be0 commit e5f9a11

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

lightning/src/ln/peer_handler.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,22 +1725,22 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, OM: Deref, L: Deref, CM
17251725
// When supporting gossip messages, start initial gossip sync only after we receive
17261726
// a GossipTimestampFilter
17271727

1728-
#[allow(unused_mut, unused_assignments)]
1729-
let mut full_sync_threshold = 0;
1730-
#[cfg(feature = "std")]
1731-
{
1732-
// if the timestamp range starts more than an hour ago, do a fully sync
1733-
// otherwise, start at the current time
1734-
use std::time::{SystemTime, UNIX_EPOCH};
1735-
full_sync_threshold = SystemTime::now().duration_since(UNIX_EPOCH).expect("Time must be > 1970").as_secs() - 3600;
1736-
}
1737-
17381728
if peer_lock.their_features.as_ref().unwrap().supports_gossip_queries() &&
1739-
!peer_lock.sent_gossip_timestamp_filter &&
1740-
(msg.first_timestamp as u64) <= full_sync_threshold
1741-
{
1729+
!peer_lock.sent_gossip_timestamp_filter {
17421730
peer_lock.sent_gossip_timestamp_filter = true;
1743-
peer_lock.sync_status = InitSyncTracker::ChannelsSyncing(0);
1731+
1732+
#[allow(unused_mut, unused_assignments)]
1733+
let mut full_sync_threshold = 0;
1734+
#[cfg(feature = "std")]
1735+
{
1736+
// if the timestamp range starts more than an hour ago, do a full sync
1737+
// otherwise, start at the current time
1738+
use std::time::{SystemTime, UNIX_EPOCH};
1739+
full_sync_threshold = SystemTime::now().duration_since(UNIX_EPOCH).expect("Time must be > 1970").as_secs() - 3600;
1740+
}
1741+
if (msg.first_timestamp as u64) <= full_sync_threshold {
1742+
peer_lock.sync_status = InitSyncTracker::ChannelsSyncing(0);
1743+
}
17441744
}
17451745
return Ok(None);
17461746
}

0 commit comments

Comments
 (0)