@@ -10304,20 +10304,17 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
1030410304 fn read<R : io::Read>(reader: &mut R, args: (&'a ES, &'b SP, u32, &'c ChannelTypeFeatures)) -> Result<Self, DecodeError> {
1030510305 let (entropy_source, signer_provider, serialized_height, our_supported_features) = args;
1030610306 let ver = read_ver_prefix!(reader, SERIALIZATION_VERSION);
10307+ if ver <= 2 {
10308+ return Err(DecodeError::UnknownVersion);
10309+ }
1030710310
1030810311 // `user_id` used to be a single u64 value. In order to remain backwards compatible with
1030910312 // versions prior to 0.0.113, the u128 is serialized as two separate u64 values. We read
1031010313 // the low bytes now and the high bytes later.
1031110314 let user_id_low: u64 = Readable::read(reader)?;
1031210315
1031310316 let mut config = Some(LegacyChannelConfig::default());
10314- if ver == 1 {
10315- // Read the old serialization of the ChannelConfig from version 0.0.98.
10316- config.as_mut().unwrap().options.forwarding_fee_proportional_millionths = Readable::read(reader)?;
10317- config.as_mut().unwrap().options.cltv_expiry_delta = Readable::read(reader)?;
10318- config.as_mut().unwrap().announce_for_forwarding = Readable::read(reader)?;
10319- config.as_mut().unwrap().commit_upfront_shutdown_pubkey = Readable::read(reader)?;
10320- } else {
10317+ {
1032110318 // Read the 8 bytes of backwards-compatibility ChannelConfig data.
1032210319 let mut _val: u64 = Readable::read(reader)?;
1032310320 }
@@ -10481,23 +10478,17 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
1048110478 let holder_dust_limit_satoshis = Readable::read(reader)?;
1048210479 let counterparty_max_htlc_value_in_flight_msat = Readable::read(reader)?;
1048310480 let mut counterparty_selected_channel_reserve_satoshis = None;
10484- if ver == 1 {
10485- // Read the old serialization from version 0.0.98.
10486- counterparty_selected_channel_reserve_satoshis = Some(Readable::read(reader)?);
10487- } else {
10488- // Read the 8 bytes of backwards-compatibility data.
10481+ {
10482+ // Read the 8 bytes of backwards-compatibility counterparty_selected_channel_reserve_satoshis data.
1048910483 let _dummy: u64 = Readable::read(reader)?;
1049010484 }
1049110485 let counterparty_htlc_minimum_msat = Readable::read(reader)?;
1049210486 let holder_htlc_minimum_msat = Readable::read(reader)?;
1049310487 let counterparty_max_accepted_htlcs = Readable::read(reader)?;
1049410488
1049510489 let mut minimum_depth = None;
10496- if ver == 1 {
10497- // Read the old serialization from version 0.0.98.
10498- minimum_depth = Some(Readable::read(reader)?);
10499- } else {
10500- // Read the 4 bytes of backwards-compatibility data.
10490+ {
10491+ // Read the 4 bytes of backwards-compatibility minimum_depth data.
1050110492 let _dummy: u32 = Readable::read(reader)?;
1050210493 }
1050310494
0 commit comments