@@ -40,7 +40,7 @@ use crate::events::{Event, EventHandler, EventsProvider, MessageSendEvent, Messa
4040// Since this struct is returned in `list_channels` methods, expose it here in case users want to
4141// construct one themselves.
4242use crate :: ln:: { inbound_payment, PaymentHash , PaymentPreimage , PaymentSecret } ;
43- use crate :: ln:: channel:: { Channel , ChannelError , ChannelUpdateStatus , UpdateFulfillCommitFetch } ;
43+ use crate :: ln:: channel:: { Channel , ChannelInterface , ChannelError , ChannelUpdateStatus , UpdateFulfillCommitFetch } ;
4444use crate :: ln:: features:: { ChannelFeatures , ChannelTypeFeatures , InitFeatures , NodeFeatures } ;
4545#[ cfg( any( feature = "_test_utils" , test) ) ]
4646use crate :: ln:: features:: InvoiceFeatures ;
@@ -1358,56 +1358,6 @@ impl ChannelDetails {
13581358 pub fn get_outbound_payment_scid ( & self ) -> Option < u64 > {
13591359 self . short_channel_id . or ( self . outbound_scid_alias )
13601360 }
1361-
1362- fn from_channel < Signer : WriteableEcdsaChannelSigner > ( channel : & Channel < Signer > ,
1363- best_block_height : u32 , latest_features : InitFeatures ) -> Self {
1364-
1365- let balance = channel. get_available_balances ( ) ;
1366- let ( to_remote_reserve_satoshis, to_self_reserve_satoshis) =
1367- channel. get_holder_counterparty_selected_channel_reserve_satoshis ( ) ;
1368- ChannelDetails {
1369- channel_id : channel. channel_id ( ) ,
1370- counterparty : ChannelCounterparty {
1371- node_id : channel. get_counterparty_node_id ( ) ,
1372- features : latest_features,
1373- unspendable_punishment_reserve : to_remote_reserve_satoshis,
1374- forwarding_info : channel. counterparty_forwarding_info ( ) ,
1375- // Ensures that we have actually received the `htlc_minimum_msat` value
1376- // from the counterparty through the `OpenChannel` or `AcceptChannel`
1377- // message (as they are always the first message from the counterparty).
1378- // Else `Channel::get_counterparty_htlc_minimum_msat` could return the
1379- // default `0` value set by `Channel::new_outbound`.
1380- outbound_htlc_minimum_msat : if channel. have_received_message ( ) {
1381- Some ( channel. get_counterparty_htlc_minimum_msat ( ) ) } else { None } ,
1382- outbound_htlc_maximum_msat : channel. get_counterparty_htlc_maximum_msat ( ) ,
1383- } ,
1384- funding_txo : channel. get_funding_txo ( ) ,
1385- // Note that accept_channel (or open_channel) is always the first message, so
1386- // `have_received_message` indicates that type negotiation has completed.
1387- channel_type : if channel. have_received_message ( ) { Some ( channel. get_channel_type ( ) . clone ( ) ) } else { None } ,
1388- short_channel_id : channel. get_short_channel_id ( ) ,
1389- outbound_scid_alias : if channel. is_usable ( ) { Some ( channel. outbound_scid_alias ( ) ) } else { None } ,
1390- inbound_scid_alias : channel. latest_inbound_scid_alias ( ) ,
1391- channel_value_satoshis : channel. get_value_satoshis ( ) ,
1392- feerate_sat_per_1000_weight : Some ( channel. get_feerate_sat_per_1000_weight ( ) ) ,
1393- unspendable_punishment_reserve : to_self_reserve_satoshis,
1394- balance_msat : balance. balance_msat ,
1395- inbound_capacity_msat : balance. inbound_capacity_msat ,
1396- outbound_capacity_msat : balance. outbound_capacity_msat ,
1397- next_outbound_htlc_limit_msat : balance. next_outbound_htlc_limit_msat ,
1398- user_channel_id : channel. get_user_id ( ) ,
1399- confirmations_required : channel. minimum_depth ( ) ,
1400- confirmations : Some ( channel. get_funding_tx_confirmations ( best_block_height) ) ,
1401- force_close_spend_delay : channel. get_counterparty_selected_contest_delay ( ) ,
1402- is_outbound : channel. is_outbound ( ) ,
1403- is_channel_ready : channel. is_usable ( ) ,
1404- is_usable : channel. is_live ( ) ,
1405- is_public : channel. should_announce ( ) ,
1406- inbound_htlc_minimum_msat : Some ( channel. get_holder_htlc_minimum_msat ( ) ) ,
1407- inbound_htlc_maximum_msat : channel. get_holder_htlc_maximum_msat ( ) ,
1408- config : Some ( channel. config ( ) ) ,
1409- }
1410- }
14111361}
14121362
14131363/// Used by [`ChannelManager::list_recent_payments`] to express the status of recent payments.
@@ -1974,8 +1924,7 @@ where
19741924 let mut peer_state_lock = peer_state_mutex. lock ( ) . unwrap ( ) ;
19751925 let peer_state = & mut * peer_state_lock;
19761926 for ( _channel_id, channel) in peer_state. channel_by_id . iter ( ) . filter ( f) {
1977- let details = ChannelDetails :: from_channel ( channel, best_block_height,
1978- peer_state. latest_features . clone ( ) ) ;
1927+ let details = channel. get_channel_details ( best_block_height, peer_state. latest_features . clone ( ) ) ;
19791928 res. push ( details) ;
19801929 }
19811930 }
@@ -2014,7 +1963,7 @@ where
20141963 return peer_state. channel_by_id
20151964 . iter ( )
20161965 . map ( |( _, channel) |
2017- ChannelDetails :: from_channel ( channel, best_block_height, features. clone ( ) ) )
1966+ channel. get_channel_details ( best_block_height, features. clone ( ) ) )
20181967 . collect ( ) ;
20191968 }
20201969 vec ! [ ]
0 commit comments