X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Frouting%2Fgossip.rs;h=47d7dab6d1132121a5da3bacf2e57cb52befb2ab;hb=31042ab7d524d75a1e9eb34080c1bdc666c9101e;hp=19f109f0cd5d2f8a041302d54becbe035acd4b3d;hpb=63d7b2bf3e4038781fed262c9cf198c430812351;p=rust-lightning diff --git a/lightning/src/routing/gossip.rs b/lightning/src/routing/gossip.rs index 19f109f0..47d7dab6 100644 --- a/lightning/src/routing/gossip.rs +++ b/lightning/src/routing/gossip.rs @@ -164,7 +164,7 @@ pub struct ReadOnlyNetworkGraph<'a> { /// return packet by a node along the route. See [BOLT #4] for details. /// /// [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub enum NetworkUpdate { /// An error indicating a `channel_update` messages should be applied via /// [`NetworkGraph::update_channel`]. @@ -626,7 +626,7 @@ where } } -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] /// Details about one direction of a channel as received within a [`ChannelUpdate`]. pub struct ChannelUpdateInfo { /// When the last update to the channel direction was issued. @@ -709,7 +709,7 @@ impl Readable for ChannelUpdateInfo { } } -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] /// Details about a channel (both directions). /// Received within a channel announcement. pub struct ChannelInfo { @@ -1017,7 +1017,7 @@ impl_writeable_tlv_based!(RoutingFees, { (2, proportional_millionths, required) }); -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] /// Information received in the latest node_announcement from this node. pub struct NodeAnnouncementInfo { /// Protocol features the node announced support for @@ -1053,7 +1053,7 @@ impl_writeable_tlv_based!(NodeAnnouncementInfo, { /// /// Since node aliases are provided by third parties, they are a potential avenue for injection /// attacks. Care must be taken when processing. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct NodeAlias(pub [u8; 32]); impl fmt::Display for NodeAlias { @@ -1094,7 +1094,7 @@ impl Readable for NodeAlias { } } -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] /// Details about a node in the network, known from the network announcement. pub struct NodeInfo { /// All valid channels a node has announced @@ -1247,6 +1247,7 @@ impl fmt::Display for NetworkGraph where L::Target: Logger { } } +impl Eq for NetworkGraph where L::Target: Logger {} impl PartialEq for NetworkGraph where L::Target: Logger { fn eq(&self, other: &Self) -> bool { self.genesis_hash == other.genesis_hash && @@ -1330,7 +1331,7 @@ impl NetworkGraph where L::Target: Logger { // updates to ensure you always have the latest one, only vaguely suggesting // that it be at least the current time. if node_info.last_update > msg.timestamp { - return Err(LightningError{err: "Update older than last processed update".to_owned(), action: ErrorAction::IgnoreAndLog(Level::Gossip)}); + return Err(LightningError{err: "Update older than last processed update".to_owned(), action: ErrorAction::IgnoreDuplicateGossip}); } else if node_info.last_update == msg.timestamp { return Err(LightningError{err: "Update had the same timestamp as last processed update".to_owned(), action: ErrorAction::IgnoreDuplicateGossip}); } @@ -1796,7 +1797,7 @@ impl NetworkGraph where L::Target: Logger { // pruning based on the timestamp field being more than two weeks old, // but only in the non-normative section. if existing_chan_info.last_update > msg.timestamp { - return Err(LightningError{err: "Update older than last processed update".to_owned(), action: ErrorAction::IgnoreAndLog(Level::Gossip)}); + return Err(LightningError{err: "Update older than last processed update".to_owned(), action: ErrorAction::IgnoreDuplicateGossip}); } else if existing_chan_info.last_update == msg.timestamp { return Err(LightningError{err: "Update had same timestamp as last processed update".to_owned(), action: ErrorAction::IgnoreDuplicateGossip}); }