@@ -10296,13 +10296,13 @@ impl<SP: Deref> Writeable for FundedChannel<SP> where SP::Target: SignerProvider
10296
10296
}
10297
10297
}
10298
10298
10299
- impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c ChannelTypeFeatures)> for FundedChannel<SP>
10299
+ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, &'c ChannelTypeFeatures)> for FundedChannel<SP>
10300
10300
where
10301
10301
ES::Target: EntropySource,
10302
10302
SP::Target: SignerProvider
10303
10303
{
10304
- fn read<R : io::Read>(reader: &mut R, args: (&'a ES, &'b SP, u32, &'c ChannelTypeFeatures)) -> Result<Self, DecodeError> {
10305
- let (entropy_source, signer_provider, serialized_height, our_supported_features) = args;
10304
+ fn read<R : io::Read>(reader: &mut R, args: (&'a ES, &'b SP, &'c ChannelTypeFeatures)) -> Result<Self, DecodeError> {
10305
+ let (entropy_source, signer_provider, our_supported_features) = args;
10306
10306
let ver = read_ver_prefix!(reader, SERIALIZATION_VERSION);
10307
10307
if ver <= 2 {
10308
10308
return Err(DecodeError::UnknownVersion);
@@ -10313,7 +10313,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
10313
10313
// the low bytes now and the high bytes later.
10314
10314
let user_id_low: u64 = Readable::read(reader)?;
10315
10315
10316
- let mut config = Some( LegacyChannelConfig::default() );
10316
+ let mut config = LegacyChannelConfig::default();
10317
10317
{
10318
10318
// Read the 8 bytes of backwards-compatibility ChannelConfig data.
10319
10319
let mut _val: u64 = Readable::read(reader)?;
@@ -10533,20 +10533,20 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
10533
10533
// Prior to supporting channel type negotiation, all of our channels were static_remotekey
10534
10534
// only, so we default to that if none was written.
10535
10535
let mut channel_type = Some(ChannelTypeFeatures::only_static_remote_key());
10536
- let mut channel_creation_height = Some(serialized_height) ;
10536
+ let mut channel_creation_height = 0u32 ;
10537
10537
let mut preimages_opt: Option<Vec<Option<PaymentPreimage>>> = None;
10538
10538
10539
10539
// If we read an old Channel, for simplicity we just treat it as "we never sent an
10540
10540
// AnnouncementSignatures" which implies we'll re-send it on reconnect, but that's fine.
10541
- let mut announcement_sigs_state = Some( AnnouncementSigsState::NotSent) ;
10541
+ let mut announcement_sigs_state = AnnouncementSigsState::NotSent;
10542
10542
let mut latest_inbound_scid_alias = None;
10543
- let mut outbound_scid_alias = None ;
10543
+ let mut outbound_scid_alias = 0u64 ;
10544
10544
let mut channel_pending_event_emitted = None;
10545
10545
let mut channel_ready_event_emitted = None;
10546
10546
let mut funding_tx_broadcast_safe_event_emitted = None;
10547
10547
10548
10548
let mut user_id_high_opt: Option<u64> = None;
10549
- let mut channel_keys_id: Option<[u8 ; 32]> = None ;
10549
+ let mut channel_keys_id = [0u8 ; 32];
10550
10550
let mut temporary_channel_id: Option<ChannelId> = None;
10551
10551
let mut holder_max_accepted_htlcs: Option<u16> = None;
10552
10552
@@ -10575,21 +10575,21 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
10575
10575
(2, channel_type, option),
10576
10576
(3, counterparty_selected_channel_reserve_satoshis, option),
10577
10577
(4, holder_selected_channel_reserve_satoshis, option),
10578
- (5, config, option), // Note that if none is provided we will *not* overwrite the existing one.
10578
+ (5, config, required),
10579
10579
(6, holder_max_htlc_value_in_flight_msat, option),
10580
10580
(7, shutdown_scriptpubkey, option),
10581
10581
(8, blocked_monitor_updates, optional_vec),
10582
10582
(9, target_closing_feerate_sats_per_kw, option),
10583
10583
(10, monitor_pending_update_adds, option), // Added in 0.0.122
10584
10584
(11, monitor_pending_finalized_fulfills, optional_vec),
10585
- (13, channel_creation_height, option ),
10585
+ (13, channel_creation_height, required ),
10586
10586
(15, preimages_opt, optional_vec),
10587
- (17, announcement_sigs_state, option ),
10587
+ (17, announcement_sigs_state, required ),
10588
10588
(19, latest_inbound_scid_alias, option),
10589
- (21, outbound_scid_alias, option ),
10589
+ (21, outbound_scid_alias, required ),
10590
10590
(23, channel_ready_event_emitted, option),
10591
10591
(25, user_id_high_opt, option),
10592
- (27, channel_keys_id, option ),
10592
+ (27, channel_keys_id, required ),
10593
10593
(28, holder_max_accepted_htlcs, option),
10594
10594
(29, temporary_channel_id, option),
10595
10595
(31, channel_pending_event_emitted, option),
@@ -10606,12 +10606,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
10606
10606
(53, funding_tx_broadcast_safe_event_emitted, option),
10607
10607
});
10608
10608
10609
- let (channel_keys_id, holder_signer) = if let Some(channel_keys_id) = channel_keys_id {
10610
- let holder_signer = signer_provider.derive_channel_signer(channel_keys_id);
10611
- (channel_keys_id, holder_signer)
10612
- } else {
10613
- return Err(DecodeError::InvalidValue);
10614
- };
10609
+ let holder_signer = signer_provider.derive_channel_signer(channel_keys_id);
10615
10610
10616
10611
if let Some(preimages) = preimages_opt {
10617
10612
let mut iter = preimages.into_iter();
@@ -10753,7 +10748,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
10753
10748
context: ChannelContext {
10754
10749
user_id,
10755
10750
10756
- config: config.unwrap() ,
10751
+ config,
10757
10752
10758
10753
prev_config: None,
10759
10754
@@ -10764,7 +10759,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
10764
10759
channel_id,
10765
10760
temporary_channel_id,
10766
10761
channel_state,
10767
- announcement_sigs_state: announcement_sigs_state.unwrap() ,
10762
+ announcement_sigs_state,
10768
10763
secp_ctx,
10769
10764
10770
10765
latest_monitor_update_id,
@@ -10814,7 +10809,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
10814
10809
funding_tx_confirmed_in,
10815
10810
funding_tx_confirmation_height,
10816
10811
short_channel_id,
10817
- channel_creation_height: channel_creation_height.unwrap() ,
10812
+ channel_creation_height,
10818
10813
10819
10814
counterparty_dust_limit_satoshis,
10820
10815
holder_dust_limit_satoshis,
@@ -10847,7 +10842,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
10847
10842
10848
10843
latest_inbound_scid_alias,
10849
10844
// Later in the ChannelManager deserialization phase we scan for channels and assign scid aliases if its missing
10850
- outbound_scid_alias: outbound_scid_alias.unwrap_or(0) ,
10845
+ outbound_scid_alias,
10851
10846
10852
10847
funding_tx_broadcast_safe_event_emitted: funding_tx_broadcast_safe_event_emitted.unwrap_or(false),
10853
10848
channel_pending_event_emitted: channel_pending_event_emitted.unwrap_or(true),
@@ -11556,7 +11551,7 @@ mod tests {
11556
11551
let mut s = crate::io::Cursor::new(&encoded_chan);
11557
11552
let mut reader = crate::util::ser::FixedLengthReader::new(&mut s, encoded_chan.len() as u64);
11558
11553
let features = channelmanager::provided_channel_type_features(&config);
11559
- let decoded_chan = FundedChannel::read(&mut reader, (&&keys_provider, &&keys_provider, 0, &features)).unwrap();
11554
+ let decoded_chan = FundedChannel::read(&mut reader, (&&keys_provider, &&keys_provider, &features)).unwrap();
11560
11555
assert_eq!(decoded_chan.context.pending_outbound_htlcs, pending_outbound_htlcs);
11561
11556
assert_eq!(decoded_chan.context.holding_cell_htlc_updates, holding_cell_htlc_updates);
11562
11557
}
0 commit comments