Skip to content

Commit 3778824

Browse files
committed
f - Remove Legacy format enum fix
1 parent 8786410 commit 3778824

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

lightning/src/ln/msgs.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use io_extras::read_to_end;
4242

4343
use util::events::{MessageSendEventsProvider, OnionMessageProvider};
4444
use util::logger;
45-
use util::ser::{BigSize, LengthReadable, Readable, ReadableArgs, Writeable, Writer, FixedLengthReader, HighZeroBytesDroppedBigSize, Hostname};
45+
use util::ser::{LengthReadable, Readable, ReadableArgs, Writeable, Writer, FixedLengthReader, HighZeroBytesDroppedBigSize, Hostname};
4646

4747
use ln::{PaymentPreimage, PaymentHash, PaymentSecret};
4848

@@ -1476,29 +1476,20 @@ impl Writeable for OnionHopData {
14761476

14771477
impl Readable for OnionHopData {
14781478
fn read<R: Read>(r: &mut R) -> Result<Self, DecodeError> {
1479-
let b: BigSize = Readable::read(r)?;
1480-
const LEGACY_ONION_HOP_FLAG: u64 = 0;
1481-
if b.0 == LEGACY_ONION_HOP_FLAG {
1482-
// Support for Legacy onion payload format has been removed as of LDK 0.XX,
1483-
// due to being deprecated in BOLT4.
1484-
return Err(DecodeError::InvalidValue);
1485-
}
1486-
1487-
let mut rd = FixedLengthReader::new(r, b.0);
14881479
let mut amt = HighZeroBytesDroppedBigSize(0u64);
14891480
let mut cltv_value = HighZeroBytesDroppedBigSize(0u32);
14901481
let mut short_id: Option<u64> = None;
14911482
let mut payment_data: Option<FinalOnionHopData> = None;
14921483
let mut keysend_preimage: Option<PaymentPreimage> = None;
1493-
decode_tlv_stream!(&mut rd, {
1484+
read_tlv_fields!(r, {
14941485
(2, amt, required),
14951486
(4, cltv_value, required),
14961487
(6, short_id, option),
14971488
(8, payment_data, option),
14981489
// See https://github.com/lightning/blips/blob/master/blip-0003.md
14991490
(5482373484, keysend_preimage, option)
15001491
});
1501-
rd.eat_remaining().map_err(|_| DecodeError::ShortRead)?;
1492+
15021493
let format = if let Some(short_channel_id) = short_id {
15031494
if payment_data.is_some() { return Err(DecodeError::InvalidValue); }
15041495
OnionHopDataFormat::NonFinalNode {

0 commit comments

Comments
 (0)