@@ -1141,6 +1141,10 @@ pub struct ChannelDetails {
11411141 /// [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
11421142 /// [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
11431143 pub confirmations_required : Option < u32 > ,
1144+ /// The current number of confirmations on the funding transaction.
1145+ ///
1146+ /// This value will be `None` for objects serialized with LDK versions prior to 0.0.113.
1147+ pub confirmations : Option < u32 > ,
11441148 /// The number of blocks (after our commitment transaction confirms) that we will need to wait
11451149 /// until we can claim our funds after we force-close the channel. During this time our
11461150 /// counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
@@ -1817,6 +1821,7 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
18171821 let mut res = Vec :: new ( ) ;
18181822 {
18191823 let channel_state = self . channel_state . lock ( ) . unwrap ( ) ;
1824+ let best_block_height = self . best_block . read ( ) . unwrap ( ) . height ( ) ;
18201825 res. reserve ( channel_state. by_id . len ( ) ) ;
18211826 for ( channel_id, channel) in channel_state. by_id . iter ( ) . filter ( f) {
18221827 let balance = channel. get_available_balances ( ) ;
@@ -1853,6 +1858,7 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
18531858 next_outbound_htlc_limit_msat : balance. next_outbound_htlc_limit_msat ,
18541859 user_channel_id : channel. get_user_id ( ) ,
18551860 confirmations_required : channel. minimum_depth ( ) ,
1861+ confirmations : Some ( channel. get_funding_tx_confirmations ( best_block_height) ) ,
18561862 force_close_spend_delay : channel. get_counterparty_selected_contest_delay ( ) ,
18571863 is_outbound : channel. is_outbound ( ) ,
18581864 is_channel_ready : channel. is_usable ( ) ,
@@ -6510,6 +6516,7 @@ impl Writeable for ChannelDetails {
65106516 ( 6 , self . funding_txo, option) ,
65116517 ( 7 , self . config, option) ,
65126518 ( 8 , self . short_channel_id, option) ,
6519+ ( 9 , self . confirmations, option) ,
65136520 ( 10 , self . channel_value_satoshis, required) ,
65146521 ( 12 , self . unspendable_punishment_reserve, option) ,
65156522 ( 14 , user_channel_id_low, required) ,
@@ -6544,6 +6551,7 @@ impl Readable for ChannelDetails {
65446551 ( 6 , funding_txo, option) ,
65456552 ( 7 , config, option) ,
65466553 ( 8 , short_channel_id, option) ,
6554+ ( 9 , confirmations, option) ,
65476555 ( 10 , channel_value_satoshis, required) ,
65486556 ( 12 , unspendable_punishment_reserve, option) ,
65496557 ( 14 , user_channel_id_low, required) ,
@@ -6587,6 +6595,7 @@ impl Readable for ChannelDetails {
65876595 next_outbound_htlc_limit_msat : next_outbound_htlc_limit_msat. 0 . unwrap ( ) ,
65886596 inbound_capacity_msat : inbound_capacity_msat. 0 . unwrap ( ) ,
65896597 confirmations_required,
6598+ confirmations,
65906599 force_close_spend_delay,
65916600 is_outbound : is_outbound. 0 . unwrap ( ) ,
65926601 is_channel_ready : is_channel_ready. 0 . unwrap ( ) ,
0 commit comments