Move BogusHopData generation into test instead of OnionHopData.
[rust-lightning] / lightning / src / ln / msgs.rs
index b48819972969cb0af09f90ea6d445b1afe1af603..ec2c98cb93cdd0b6733937a176868624ee05c162 100644 (file)
@@ -612,11 +612,6 @@ mod fuzzy_internal_msgs {
 
        pub(crate) enum OnionHopDataFormat {
                Legacy, // aka Realm-0
-               // Some tests expect to be able to generate bogus non-deserializable OnionHopDatas. In the
-               // future we can use bogus TLV attributes, but for now we have to expose a "bogus realm"
-               // option.
-               #[cfg(test)]
-               BogusRealm(u8),
        }
 
        pub struct OnionHopData {
@@ -625,7 +620,6 @@ mod fuzzy_internal_msgs {
                pub(crate) amt_to_forward: u64,
                pub(crate) outgoing_cltv_value: u32,
                // 12 bytes of 0-padding
-               pub(crate) hmac: [u8; 32],
        }
 
        pub struct DecodedOnionErrorPacket {
@@ -964,17 +958,14 @@ impl_writeable!(UpdateAddHTLC, 32+8+8+32+4+1366, {
 
 impl Writeable for OnionHopData {
        fn write<W: Writer>(&self, w: &mut W) -> Result<(), ::std::io::Error> {
-               w.size_hint(65);
+               w.size_hint(33);
                match self.format {
                        OnionHopDataFormat::Legacy => 0u8.write(w)?,
-                       #[cfg(test)]
-                       OnionHopDataFormat::BogusRealm(v) => v.write(w)?,
                }
                self.short_channel_id.write(w)?;
                self.amt_to_forward.write(w)?;
                self.outgoing_cltv_value.write(w)?;
                w.write_all(&[0;12])?;
-               self.hmac.write(w)?;
                Ok(())
        }
 }
@@ -996,7 +987,6 @@ impl<R: Read> Readable<R> for OnionHopData {
                                r.read_exact(&mut [0; 12])?;
                                v
                        },
-                       hmac: Readable::read(r)?,
                })
        }
 }