Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
node: Fix node announcements not being received
cloudhead committed 2 years ago
commit 99aeae19ea105660746db99814bc1f8ceb7133bd
parent 9ada30255b11e331a04d11a36d0088c66415b0a8
1 file changed +12 -0
modified radicle-node/src/runtime.rs
@@ -156,6 +156,18 @@ impl Runtime {
            .ok()
            .and_then(|ann| NodeAnnouncement::decode(&mut ann.as_slice()).ok())
            .and_then(|ann| {
+
                // If our announcement was made some time ago, the timestamp on it will be old,
+
                // and it might not get gossiped to new nodes since it will be purged from caches.
+
                // Therefore, we make sure it's never too old.
+
                if clock.as_millis() - ann.timestamp
+
                    <= config.limits.gossip_max_age.as_millis() as u64
+
                {
+
                    Some(ann)
+
                } else {
+
                    None
+
                }
+
            })
+
            .and_then(|ann| {
                if config.features() == ann.features
                    && config.alias == ann.alias
                    && config.external_addresses == ann.addresses.as_ref()