Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
node: Always try to relay node announcements
cloudhead committed 2 years ago
commit a815640a3bdcdaf22d4753a6f73c53ed6631b3aa
parent 97b1a5de538e6ea3401a1f96ce14d01742bb6a61
2 files changed +11 -4
modified radicle-node/src/service.rs
@@ -1338,11 +1338,14 @@ where
        let now = self.clock;
        let timestamp = message.timestamp();
        // To avoid spamming peers on startup with historical gossip messages,
-
        // don't relay messages that are too old.
-
        let relay = if now - timestamp.to_local_time() > MAX_TIME_DELTA {
-
            false
-
        } else {
+
        // don't relay messages that are too old. We make an exception for node announcements,
+
        // since they are cached, and will hence often carry old timestamps.
+
        let relay = if message.is_node_announcement()
+
            || now - timestamp.to_local_time() <= MAX_TIME_DELTA
+
        {
            self.config.relay
+
        } else {
+
            false
        };

        // Don't allow messages from too far in the future.
modified radicle-node/src/service/message.rs
@@ -274,6 +274,10 @@ impl AnnouncementMessage {
            Self::Node(NodeAnnouncement { timestamp, .. }) => *timestamp,
        }
    }
+

+
    pub fn is_node_announcement(&self) -> bool {
+
        matches!(self, Self::Node(_))
+
    }
}

impl From<NodeAnnouncement> for AnnouncementMessage {