Skip to content

Commit 4e7d5d7

Browse files
committed
f catch underflow too
1 parent faa3bc5 commit 4e7d5d7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lightning/src/routing/network_graph.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,8 @@ impl NetworkGraph {
10901090
pub fn remove_stale_channels_with_time(&self, current_time_unix: u64) {
10911091
let mut channels = self.channels.write().unwrap();
10921092
// Time out if we haven't received an update in at least 14 days.
1093-
if current_time_unix > u32::max_value() { return; } // Remove by 2106
1093+
if current_time_unix > u32::max_value() as u64 { return; } // Remove by 2106
1094+
if current_time_unix < STALE_CHANNEL_UPDATE_AGE_LIMIT_SECS { return; }
10941095
let min_time_unix: u32 = (current_time_unix - STALE_CHANNEL_UPDATE_AGE_LIMIT_SECS) as u32;
10951096
// Sadly BTreeMap::retain was only stabilized in 1.53 so we can't switch to it for some
10961097
// time.

0 commit comments

Comments
 (0)