From: Valentine Wallace Date: Sat, 6 Aug 2022 02:18:27 +0000 (-0400) Subject: Minor msgs::OnionHopData cleanups X-Git-Tag: v0.0.111~39^2~2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=dcef41d17b822c7d6da36239101cef96df011f61;p=rust-lightning Minor msgs::OnionHopData cleanups --- 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)?;