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,
}
}
-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[..]))