@@ -46,7 +46,7 @@ use crate::events::{Event, EventHandler, EventsProvider, MessageSendEvent, Messa
4646use crate::ln::inbound_payment;
4747use crate::ln::types::{ChannelId, PaymentHash, PaymentPreimage, PaymentSecret};
4848use crate::ln::channel::{self, Channel, ChannelPhase, ChannelContext, ChannelError, ChannelUpdateStatus, ShutdownResult, UnfundedChannelContext, UpdateFulfillCommitFetch, OutboundV1Channel, InboundV1Channel, WithChannelContext};
49- use crate::ln::channel_state::{ChannelCounterparty, ChannelDetails, ChannelShutdownState, CounterpartyForwardingInfo} ;
49+ use crate::ln::channel_state::ChannelDetails;
5050use crate::ln::features::{Bolt12InvoiceFeatures, ChannelFeatures, ChannelTypeFeatures, InitFeatures, NodeFeatures};
5151#[cfg(any(feature = "_test_utils", test))]
5252use crate::ln::features::Bolt11InvoiceFeatures;
@@ -10274,140 +10274,6 @@ pub fn provided_init_features(config: &UserConfig) -> InitFeatures {
1027410274const SERIALIZATION_VERSION: u8 = 1;
1027510275const MIN_SERIALIZATION_VERSION: u8 = 1;
1027610276
10277- impl_writeable_tlv_based!(CounterpartyForwardingInfo, {
10278- (2, fee_base_msat, required),
10279- (4, fee_proportional_millionths, required),
10280- (6, cltv_expiry_delta, required),
10281- });
10282-
10283- impl_writeable_tlv_based!(ChannelCounterparty, {
10284- (2, node_id, required),
10285- (4, features, required),
10286- (6, unspendable_punishment_reserve, required),
10287- (8, forwarding_info, option),
10288- (9, outbound_htlc_minimum_msat, option),
10289- (11, outbound_htlc_maximum_msat, option),
10290- });
10291-
10292- impl Writeable for ChannelDetails {
10293- fn write<W: Writer>(&self, writer: &mut W) -> Result<(), io::Error> {
10294- // `user_channel_id` used to be a single u64 value. In order to remain backwards compatible with
10295- // versions prior to 0.0.113, the u128 is serialized as two separate u64 values.
10296- let user_channel_id_low = self.user_channel_id as u64;
10297- let user_channel_id_high_opt = Some((self.user_channel_id >> 64) as u64);
10298- write_tlv_fields!(writer, {
10299- (1, self.inbound_scid_alias, option),
10300- (2, self.channel_id, required),
10301- (3, self.channel_type, option),
10302- (4, self.counterparty, required),
10303- (5, self.outbound_scid_alias, option),
10304- (6, self.funding_txo, option),
10305- (7, self.config, option),
10306- (8, self.short_channel_id, option),
10307- (9, self.confirmations, option),
10308- (10, self.channel_value_satoshis, required),
10309- (12, self.unspendable_punishment_reserve, option),
10310- (14, user_channel_id_low, required),
10311- (16, self.balance_msat, required),
10312- (18, self.outbound_capacity_msat, required),
10313- (19, self.next_outbound_htlc_limit_msat, required),
10314- (20, self.inbound_capacity_msat, required),
10315- (21, self.next_outbound_htlc_minimum_msat, required),
10316- (22, self.confirmations_required, option),
10317- (24, self.force_close_spend_delay, option),
10318- (26, self.is_outbound, required),
10319- (28, self.is_channel_ready, required),
10320- (30, self.is_usable, required),
10321- (32, self.is_public, required),
10322- (33, self.inbound_htlc_minimum_msat, option),
10323- (35, self.inbound_htlc_maximum_msat, option),
10324- (37, user_channel_id_high_opt, option),
10325- (39, self.feerate_sat_per_1000_weight, option),
10326- (41, self.channel_shutdown_state, option),
10327- (43, self.pending_inbound_htlcs, optional_vec),
10328- (45, self.pending_outbound_htlcs, optional_vec),
10329- });
10330- Ok(())
10331- }
10332- }
10333-
10334- impl Readable for ChannelDetails {
10335- fn read<R: Read>(reader: &mut R) -> Result<Self, DecodeError> {
10336- _init_and_read_len_prefixed_tlv_fields!(reader, {
10337- (1, inbound_scid_alias, option),
10338- (2, channel_id, required),
10339- (3, channel_type, option),
10340- (4, counterparty, required),
10341- (5, outbound_scid_alias, option),
10342- (6, funding_txo, option),
10343- (7, config, option),
10344- (8, short_channel_id, option),
10345- (9, confirmations, option),
10346- (10, channel_value_satoshis, required),
10347- (12, unspendable_punishment_reserve, option),
10348- (14, user_channel_id_low, required),
10349- (16, balance_msat, required),
10350- (18, outbound_capacity_msat, required),
10351- // Note that by the time we get past the required read above, outbound_capacity_msat will be
10352- // filled in, so we can safely unwrap it here.
10353- (19, next_outbound_htlc_limit_msat, (default_value, outbound_capacity_msat.0.unwrap() as u64)),
10354- (20, inbound_capacity_msat, required),
10355- (21, next_outbound_htlc_minimum_msat, (default_value, 0)),
10356- (22, confirmations_required, option),
10357- (24, force_close_spend_delay, option),
10358- (26, is_outbound, required),
10359- (28, is_channel_ready, required),
10360- (30, is_usable, required),
10361- (32, is_public, required),
10362- (33, inbound_htlc_minimum_msat, option),
10363- (35, inbound_htlc_maximum_msat, option),
10364- (37, user_channel_id_high_opt, option),
10365- (39, feerate_sat_per_1000_weight, option),
10366- (41, channel_shutdown_state, option),
10367- (43, pending_inbound_htlcs, optional_vec),
10368- (45, pending_outbound_htlcs, optional_vec),
10369- });
10370-
10371- // `user_channel_id` used to be a single u64 value. In order to remain backwards compatible with
10372- // versions prior to 0.0.113, the u128 is serialized as two separate u64 values.
10373- let user_channel_id_low: u64 = user_channel_id_low.0.unwrap();
10374- let user_channel_id = user_channel_id_low as u128 +
10375- ((user_channel_id_high_opt.unwrap_or(0 as u64) as u128) << 64);
10376-
10377- Ok(Self {
10378- inbound_scid_alias,
10379- channel_id: channel_id.0.unwrap(),
10380- channel_type,
10381- counterparty: counterparty.0.unwrap(),
10382- outbound_scid_alias,
10383- funding_txo,
10384- config,
10385- short_channel_id,
10386- channel_value_satoshis: channel_value_satoshis.0.unwrap(),
10387- unspendable_punishment_reserve,
10388- user_channel_id,
10389- balance_msat: balance_msat.0.unwrap(),
10390- outbound_capacity_msat: outbound_capacity_msat.0.unwrap(),
10391- next_outbound_htlc_limit_msat: next_outbound_htlc_limit_msat.0.unwrap(),
10392- next_outbound_htlc_minimum_msat: next_outbound_htlc_minimum_msat.0.unwrap(),
10393- inbound_capacity_msat: inbound_capacity_msat.0.unwrap(),
10394- confirmations_required,
10395- confirmations,
10396- force_close_spend_delay,
10397- is_outbound: is_outbound.0.unwrap(),
10398- is_channel_ready: is_channel_ready.0.unwrap(),
10399- is_usable: is_usable.0.unwrap(),
10400- is_public: is_public.0.unwrap(),
10401- inbound_htlc_minimum_msat,
10402- inbound_htlc_maximum_msat,
10403- feerate_sat_per_1000_weight,
10404- channel_shutdown_state,
10405- pending_inbound_htlcs: pending_inbound_htlcs.unwrap_or(Vec::new()),
10406- pending_outbound_htlcs: pending_outbound_htlcs.unwrap_or(Vec::new()),
10407- })
10408- }
10409- }
10410-
1041110277impl_writeable_tlv_based!(PhantomRouteHints, {
1041210278 (2, channels, required_vec),
1041310279 (4, phantom_scid, required),
@@ -11042,14 +10908,6 @@ impl Readable for VecDeque<(Event, Option<EventCompletionAction>)> {
1104210908 }
1104310909}
1104410910
11045- impl_writeable_tlv_based_enum!(ChannelShutdownState,
11046- (0, NotShuttingDown) => {},
11047- (2, ShutdownInitiated) => {},
11048- (4, ResolvingHTLCs) => {},
11049- (6, NegotiatingClosingFee) => {},
11050- (8, ShutdownComplete) => {}, ;
11051- );
11052-
1105310911/// Arguments for the creation of a ChannelManager that are not deserialized.
1105410912///
1105510913/// At a high-level, the process for deserializing a ChannelManager and resuming normal operation
0 commit comments