node: Always try to relay node announcements
They are cached and will often be old. They should still be relayed.
This commit is contained in:
parent
97b1a5de53
commit
a815640a3b
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue