@@ -10304,20 +10304,17 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
10304
10304
fn read<R : io::Read>(reader: &mut R, args: (&'a ES, &'b SP, u32, &'c ChannelTypeFeatures)) -> Result<Self, DecodeError> {
10305
10305
let (entropy_source, signer_provider, serialized_height, our_supported_features) = args;
10306
10306
let ver = read_ver_prefix!(reader, SERIALIZATION_VERSION);
10307
+ if ver <= 2 {
10308
+ return Err(DecodeError::UnknownVersion);
10309
+ }
10307
10310
10308
10311
// `user_id` used to be a single u64 value. In order to remain backwards compatible with
10309
10312
// versions prior to 0.0.113, the u128 is serialized as two separate u64 values. We read
10310
10313
// the low bytes now and the high bytes later.
10311
10314
let user_id_low: u64 = Readable::read(reader)?;
10312
10315
10313
10316
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
+ {
10321
10318
// Read the 8 bytes of backwards-compatibility ChannelConfig data.
10322
10319
let mut _val: u64 = Readable::read(reader)?;
10323
10320
}
@@ -10481,23 +10478,17 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
10481
10478
let holder_dust_limit_satoshis = Readable::read(reader)?;
10482
10479
let counterparty_max_htlc_value_in_flight_msat = Readable::read(reader)?;
10483
10480
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.
10489
10483
let _dummy: u64 = Readable::read(reader)?;
10490
10484
}
10491
10485
let counterparty_htlc_minimum_msat = Readable::read(reader)?;
10492
10486
let holder_htlc_minimum_msat = Readable::read(reader)?;
10493
10487
let counterparty_max_accepted_htlcs = Readable::read(reader)?;
10494
10488
10495
10489
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.
10501
10492
let _dummy: u32 = Readable::read(reader)?;
10502
10493
}
10503
10494
0 commit comments