Rely on const generic big arrays for `PartialEq` in msgs
[rust-lightning] / lightning / src / ln / msgs.rs
index d43ad6d0aebc2fd372c5c7837349a9beac0ebedf..47a98f734f011f7201770b212b2261f660a2afad 100644 (file)
@@ -1675,7 +1675,7 @@ pub use self::fuzzy_internal_msgs::*;
 pub(crate) use self::fuzzy_internal_msgs::*;
 
 /// BOLT 4 onion packet including hop data for the next peer.
-#[derive(Clone)]
+#[derive(Clone, PartialEq, Eq)]
 pub struct OnionPacket {
        /// BOLT 4 version number.
        pub version: u8,
@@ -1703,18 +1703,6 @@ impl onion_utils::Packet for OnionPacket {
        }
 }
 
-impl Eq for OnionPacket { }
-impl PartialEq for OnionPacket {
-       fn eq(&self, other: &OnionPacket) -> bool {
-               for (i, j) in self.hop_data.iter().zip(other.hop_data.iter()) {
-                       if i != j { return false; }
-               }
-               self.version == other.version &&
-                       self.public_key == other.public_key &&
-                       self.hmac == other.hmac
-       }
-}
-
 impl fmt::Debug for OnionPacket {
        fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
                f.write_fmt(format_args!("OnionPacket version {} with hmac {:?}", self.version, &self.hmac[..]))