@@ -359,25 +359,11 @@ pub struct ChannelDetails {
359359 ///
360360 /// This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
361361 pub feerate_sat_per_1000_weight : Option < u32 > ,
362- /// Our total balance. This is the amount we would get if we close the channel.
363- /// This value is not exact. Due to various in-flight changes and feerate changes, exactly this
364- /// amount is not likely to be recoverable on close.
365- ///
366- /// This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
367- /// balance is not available for inclusion in new outbound HTLCs). This further does not include
368- /// any pending outgoing HTLCs which are awaiting some other resolution to be sent.
369- /// This does not consider any on-chain fees.
370- ///
371- /// See also [`ChannelDetails::outbound_capacity_msat`]
372- #[ deprecated( since = "0.0.124" , note = "use [`ChainMonitor::get_claimable_balances`] instead" ) ]
373- pub balance_msat : u64 ,
374362 /// The available outbound capacity for sending HTLCs to the remote peer. This does not include
375363 /// any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
376364 /// available for inclusion in new outbound HTLCs). This further does not include any pending
377365 /// outgoing HTLCs which are awaiting some other resolution to be sent.
378366 ///
379- /// See also [`ChannelDetails::balance_msat`]
380- ///
381367 /// This value is not exact. Due to various in-flight changes, feerate changes, and our
382368 /// conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
383369 /// should be able to spend nearly this amount.
@@ -387,8 +373,8 @@ pub struct ChannelDetails {
387373 /// the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
388374 /// to use a limit as close as possible to the HTLC limit we can currently send.
389375 ///
390- /// See also [`ChannelDetails::next_outbound_htlc_minimum_msat`],
391- /// [`ChannelDetails::balance_msat`], and [`ChannelDetails:: outbound_capacity_msat`].
376+ /// See also [`ChannelDetails::next_outbound_htlc_minimum_msat`] and
377+ /// [`ChannelDetails::outbound_capacity_msat`].
392378 pub next_outbound_htlc_limit_msat : u64 ,
393379 /// The minimum value for sending a single HTLC to the remote peer. This is the equivalent of
394380 /// [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than
@@ -540,7 +526,6 @@ impl ChannelDetails {
540526 channel_value_satoshis : context. get_value_satoshis ( ) ,
541527 feerate_sat_per_1000_weight : Some ( context. get_feerate_sat_per_1000_weight ( ) ) ,
542528 unspendable_punishment_reserve : to_self_reserve_satoshis,
543- balance_msat : balance. balance_msat ,
544529 inbound_capacity_msat : balance. inbound_capacity_msat ,
545530 outbound_capacity_msat : balance. outbound_capacity_msat ,
546531 next_outbound_htlc_limit_msat : balance. next_outbound_htlc_limit_msat ,
@@ -569,41 +554,38 @@ impl Writeable for ChannelDetails {
569554 // versions prior to 0.0.113, the u128 is serialized as two separate u64 values.
570555 let user_channel_id_low = self . user_channel_id as u64 ;
571556 let user_channel_id_high_opt = Some ( ( self . user_channel_id >> 64 ) as u64 ) ;
572- #[ allow( deprecated) ] // TODO: Remove once balance_msat is removed.
573- {
574- write_tlv_fields ! ( writer, {
575- ( 1 , self . inbound_scid_alias, option) ,
576- ( 2 , self . channel_id, required) ,
577- ( 3 , self . channel_type, option) ,
578- ( 4 , self . counterparty, required) ,
579- ( 5 , self . outbound_scid_alias, option) ,
580- ( 6 , self . funding_txo, option) ,
581- ( 7 , self . config, option) ,
582- ( 8 , self . short_channel_id, option) ,
583- ( 9 , self . confirmations, option) ,
584- ( 10 , self . channel_value_satoshis, required) ,
585- ( 12 , self . unspendable_punishment_reserve, option) ,
586- ( 14 , user_channel_id_low, required) ,
587- ( 16 , self . balance_msat, required) ,
588- ( 18 , self . outbound_capacity_msat, required) ,
589- ( 19 , self . next_outbound_htlc_limit_msat, required) ,
590- ( 20 , self . inbound_capacity_msat, required) ,
591- ( 21 , self . next_outbound_htlc_minimum_msat, required) ,
592- ( 22 , self . confirmations_required, option) ,
593- ( 24 , self . force_close_spend_delay, option) ,
594- ( 26 , self . is_outbound, required) ,
595- ( 28 , self . is_channel_ready, required) ,
596- ( 30 , self . is_usable, required) ,
597- ( 32 , self . is_public, required) ,
598- ( 33 , self . inbound_htlc_minimum_msat, option) ,
599- ( 35 , self . inbound_htlc_maximum_msat, option) ,
600- ( 37 , user_channel_id_high_opt, option) ,
601- ( 39 , self . feerate_sat_per_1000_weight, option) ,
602- ( 41 , self . channel_shutdown_state, option) ,
603- ( 43 , self . pending_inbound_htlcs, optional_vec) ,
604- ( 45 , self . pending_outbound_htlcs, optional_vec) ,
605- } ) ;
606- }
557+ write_tlv_fields ! ( writer, {
558+ ( 1 , self . inbound_scid_alias, option) ,
559+ ( 2 , self . channel_id, required) ,
560+ ( 3 , self . channel_type, option) ,
561+ ( 4 , self . counterparty, required) ,
562+ ( 5 , self . outbound_scid_alias, option) ,
563+ ( 6 , self . funding_txo, option) ,
564+ ( 7 , self . config, option) ,
565+ ( 8 , self . short_channel_id, option) ,
566+ ( 9 , self . confirmations, option) ,
567+ ( 10 , self . channel_value_satoshis, required) ,
568+ ( 12 , self . unspendable_punishment_reserve, option) ,
569+ ( 14 , user_channel_id_low, required) ,
570+ ( 16 , self . next_outbound_htlc_limit_msat, required) , // Forwards compatibility for removed balance_msat field.
571+ ( 18 , self . outbound_capacity_msat, required) ,
572+ ( 19 , self . next_outbound_htlc_limit_msat, required) ,
573+ ( 20 , self . inbound_capacity_msat, required) ,
574+ ( 21 , self . next_outbound_htlc_minimum_msat, required) ,
575+ ( 22 , self . confirmations_required, option) ,
576+ ( 24 , self . force_close_spend_delay, option) ,
577+ ( 26 , self . is_outbound, required) ,
578+ ( 28 , self . is_channel_ready, required) ,
579+ ( 30 , self . is_usable, required) ,
580+ ( 32 , self . is_public, required) ,
581+ ( 33 , self . inbound_htlc_minimum_msat, option) ,
582+ ( 35 , self . inbound_htlc_maximum_msat, option) ,
583+ ( 37 , user_channel_id_high_opt, option) ,
584+ ( 39 , self . feerate_sat_per_1000_weight, option) ,
585+ ( 41 , self . channel_shutdown_state, option) ,
586+ ( 43 , self . pending_inbound_htlcs, optional_vec) ,
587+ ( 45 , self . pending_outbound_htlcs, optional_vec) ,
588+ } ) ;
607589 Ok ( ( ) )
608590 }
609591}
@@ -623,7 +605,7 @@ impl Readable for ChannelDetails {
623605 ( 10 , channel_value_satoshis, required) ,
624606 ( 12 , unspendable_punishment_reserve, option) ,
625607 ( 14 , user_channel_id_low, required) ,
626- ( 16 , balance_msat , required ) ,
608+ ( 16 , _balance_msat , option ) , // Backwards compatibility for removed balance_msat field.
627609 ( 18 , outbound_capacity_msat, required) ,
628610 // Note that by the time we get past the required read above, outbound_capacity_msat will be
629611 // filled in, so we can safely unwrap it here.
@@ -651,7 +633,8 @@ impl Readable for ChannelDetails {
651633 let user_channel_id = user_channel_id_low as u128
652634 + ( ( user_channel_id_high_opt. unwrap_or ( 0 as u64 ) as u128 ) << 64 ) ;
653635
654- #[ allow( deprecated) ] // TODO: Remove once balance_msat is removed.
636+ let _balance_msat: Option < u64 > = _balance_msat;
637+
655638 Ok ( Self {
656639 inbound_scid_alias,
657640 channel_id : channel_id. 0 . unwrap ( ) ,
@@ -664,7 +647,6 @@ impl Readable for ChannelDetails {
664647 channel_value_satoshis : channel_value_satoshis. 0 . unwrap ( ) ,
665648 unspendable_punishment_reserve,
666649 user_channel_id,
667- balance_msat : balance_msat. 0 . unwrap ( ) ,
668650 outbound_capacity_msat : outbound_capacity_msat. 0 . unwrap ( ) ,
669651 next_outbound_htlc_limit_msat : next_outbound_htlc_limit_msat. 0 . unwrap ( ) ,
670652 next_outbound_htlc_minimum_msat : next_outbound_htlc_minimum_msat. 0 . unwrap ( ) ,
@@ -762,7 +744,6 @@ mod tests {
762744 inbound_scid_alias : None ,
763745 channel_value_satoshis : 50_100 ,
764746 user_channel_id : ( u64:: MAX as u128 ) + 1 , // Gets us into the high bytes
765- balance_msat : 23_100 ,
766747 outbound_capacity_msat : 24_300 ,
767748 next_outbound_htlc_limit_msat : 20_000 ,
768749 next_outbound_htlc_minimum_msat : 132 ,
0 commit comments