Skip to content

Commit dcef41d

Browse files
Minor msgs::OnionHopData cleanups
1 parent b4521f5 commit dcef41d

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lightning/src/ln/msgs.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,14 +1417,6 @@ impl Writeable for OnionHopData {
14171417
}
14181418
}
14191419

1420-
// ReadableArgs because we need onion_utils::decode_next_hop to accommodate payment packets and
1421-
// onion message packets.
1422-
impl ReadableArgs<()> for OnionHopData {
1423-
fn read<R: Read>(r: &mut R, _arg: ()) -> Result<Self, DecodeError> {
1424-
<Self as Readable>::read(r)
1425-
}
1426-
}
1427-
14281420
impl Readable for OnionHopData {
14291421
fn read<R: Read>(mut r: &mut R) -> Result<Self, DecodeError> {
14301422
use bitcoin::consensus::encode::{Decodable, Error, VarInt};
@@ -1441,12 +1433,12 @@ impl Readable for OnionHopData {
14411433
let mut short_id: Option<u64> = None;
14421434
let mut payment_data: Option<FinalOnionHopData> = None;
14431435
let mut keysend_preimage: Option<PaymentPreimage> = None;
1444-
// The TLV type is chosen to be compatible with lnd and c-lightning.
14451436
decode_tlv_stream!(&mut rd, {
14461437
(2, amt, required),
14471438
(4, cltv_value, required),
14481439
(6, short_id, option),
14491440
(8, payment_data, option),
1441+
// See https://github.com/lightning/blips/blob/master/blip-0003.md
14501442
(5482373484, keysend_preimage, option)
14511443
});
14521444
rd.eat_remaining().map_err(|_| DecodeError::ShortRead)?;
@@ -1488,6 +1480,14 @@ impl Readable for OnionHopData {
14881480
}
14891481
}
14901482

1483+
// ReadableArgs because we need onion_utils::decode_next_hop to accommodate payment packets and
1484+
// onion message packets.
1485+
impl ReadableArgs<()> for OnionHopData {
1486+
fn read<R: Read>(r: &mut R, _arg: ()) -> Result<Self, DecodeError> {
1487+
<Self as Readable>::read(r)
1488+
}
1489+
}
1490+
14911491
impl Writeable for Ping {
14921492
fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
14931493
self.ponglen.write(w)?;

0 commit comments

Comments
 (0)