X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fmsgs.rs;h=9886bfeea5e511fd180d3decd9f3158cc64f916f;hb=dcef41d17b822c7d6da36239101cef96df011f61;hp=05a336c18eff5634e0fee7f2cec8b86a66e02a89;hpb=736c0b9e7f3dfe022e9bcd73717d17c21fe68355;p=rust-lightning diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs index 05a336c1..9886bfee 100644 --- a/lightning/src/ln/msgs.rs +++ b/lightning/src/ln/msgs.rs @@ -1417,14 +1417,6 @@ impl Writeable for OnionHopData { } } -// ReadableArgs because we need onion_utils::decode_next_hop to accommodate payment packets and -// onion message packets. -impl ReadableArgs<()> for OnionHopData { - fn read(r: &mut R, _arg: ()) -> Result { - ::read(r) - } -} - impl Readable for OnionHopData { fn read(mut r: &mut R) -> Result { use bitcoin::consensus::encode::{Decodable, Error, VarInt}; @@ -1441,12 +1433,12 @@ impl Readable for OnionHopData { let mut short_id: Option = None; let mut payment_data: Option = None; let mut keysend_preimage: Option = None; - // The TLV type is chosen to be compatible with lnd and c-lightning. decode_tlv_stream!(&mut rd, { (2, amt, required), (4, cltv_value, required), (6, short_id, option), (8, payment_data, option), + // See https://github.com/lightning/blips/blob/master/blip-0003.md (5482373484, keysend_preimage, option) }); rd.eat_remaining().map_err(|_| DecodeError::ShortRead)?; @@ -1488,6 +1480,14 @@ impl Readable for OnionHopData { } } +// ReadableArgs because we need onion_utils::decode_next_hop to accommodate payment packets and +// onion message packets. +impl ReadableArgs<()> for OnionHopData { + fn read(r: &mut R, _arg: ()) -> Result { + ::read(r) + } +} + impl Writeable for Ping { fn write(&self, w: &mut W) -> Result<(), io::Error> { self.ponglen.write(w)?;