@@ -1466,54 +1466,54 @@ impl ChannelDetails {
1466
1466
self . short_channel_id . or ( self . outbound_scid_alias )
1467
1467
}
1468
1468
1469
- fn from_channel < Signer : WriteableEcdsaChannelSigner > ( channel : & Channel < Signer > ,
1469
+ fn from_channel_context < Signer : WriteableEcdsaChannelSigner > ( context : & ChannelContext < Signer > ,
1470
1470
best_block_height : u32 , latest_features : InitFeatures ) -> Self {
1471
1471
1472
- let balance = channel . context . get_available_balances ( ) ;
1472
+ let balance = context. get_available_balances ( ) ;
1473
1473
let ( to_remote_reserve_satoshis, to_self_reserve_satoshis) =
1474
- channel . context . get_holder_counterparty_selected_channel_reserve_satoshis ( ) ;
1474
+ context. get_holder_counterparty_selected_channel_reserve_satoshis ( ) ;
1475
1475
ChannelDetails {
1476
- channel_id : channel . context . channel_id ( ) ,
1476
+ channel_id : context. channel_id ( ) ,
1477
1477
counterparty : ChannelCounterparty {
1478
- node_id : channel . context . get_counterparty_node_id ( ) ,
1478
+ node_id : context. get_counterparty_node_id ( ) ,
1479
1479
features : latest_features,
1480
1480
unspendable_punishment_reserve : to_remote_reserve_satoshis,
1481
- forwarding_info : channel . context . counterparty_forwarding_info ( ) ,
1481
+ forwarding_info : context. counterparty_forwarding_info ( ) ,
1482
1482
// Ensures that we have actually received the `htlc_minimum_msat` value
1483
1483
// from the counterparty through the `OpenChannel` or `AcceptChannel`
1484
1484
// message (as they are always the first message from the counterparty).
1485
1485
// Else `Channel::get_counterparty_htlc_minimum_msat` could return the
1486
1486
// default `0` value set by `Channel::new_outbound`.
1487
- outbound_htlc_minimum_msat : if channel . context . have_received_message ( ) {
1488
- Some ( channel . context . get_counterparty_htlc_minimum_msat ( ) ) } else { None } ,
1489
- outbound_htlc_maximum_msat : channel . context . get_counterparty_htlc_maximum_msat ( ) ,
1487
+ outbound_htlc_minimum_msat : if context. have_received_message ( ) {
1488
+ Some ( context. get_counterparty_htlc_minimum_msat ( ) ) } else { None } ,
1489
+ outbound_htlc_maximum_msat : context. get_counterparty_htlc_maximum_msat ( ) ,
1490
1490
} ,
1491
- funding_txo : channel . context . get_funding_txo ( ) ,
1491
+ funding_txo : context. get_funding_txo ( ) ,
1492
1492
// Note that accept_channel (or open_channel) is always the first message, so
1493
1493
// `have_received_message` indicates that type negotiation has completed.
1494
- channel_type : if channel . context . have_received_message ( ) { Some ( channel . context . get_channel_type ( ) . clone ( ) ) } else { None } ,
1495
- short_channel_id : channel . context . get_short_channel_id ( ) ,
1496
- outbound_scid_alias : if channel . context . is_usable ( ) { Some ( channel . context . outbound_scid_alias ( ) ) } else { None } ,
1497
- inbound_scid_alias : channel . context . latest_inbound_scid_alias ( ) ,
1498
- channel_value_satoshis : channel . context . get_value_satoshis ( ) ,
1499
- feerate_sat_per_1000_weight : Some ( channel . context . get_feerate_sat_per_1000_weight ( ) ) ,
1494
+ channel_type : if context. have_received_message ( ) { Some ( context. get_channel_type ( ) . clone ( ) ) } else { None } ,
1495
+ short_channel_id : context. get_short_channel_id ( ) ,
1496
+ outbound_scid_alias : if context. is_usable ( ) { Some ( context. outbound_scid_alias ( ) ) } else { None } ,
1497
+ inbound_scid_alias : context. latest_inbound_scid_alias ( ) ,
1498
+ channel_value_satoshis : context. get_value_satoshis ( ) ,
1499
+ feerate_sat_per_1000_weight : Some ( context. get_feerate_sat_per_1000_weight ( ) ) ,
1500
1500
unspendable_punishment_reserve : to_self_reserve_satoshis,
1501
1501
balance_msat : balance. balance_msat ,
1502
1502
inbound_capacity_msat : balance. inbound_capacity_msat ,
1503
1503
outbound_capacity_msat : balance. outbound_capacity_msat ,
1504
1504
next_outbound_htlc_limit_msat : balance. next_outbound_htlc_limit_msat ,
1505
1505
next_outbound_htlc_minimum_msat : balance. next_outbound_htlc_minimum_msat ,
1506
- user_channel_id : channel . context . get_user_id ( ) ,
1507
- confirmations_required : channel . context . minimum_depth ( ) ,
1508
- confirmations : Some ( channel . context . get_funding_tx_confirmations ( best_block_height) ) ,
1509
- force_close_spend_delay : channel . context . get_counterparty_selected_contest_delay ( ) ,
1510
- is_outbound : channel . context . is_outbound ( ) ,
1511
- is_channel_ready : channel . context . is_usable ( ) ,
1512
- is_usable : channel . context . is_live ( ) ,
1513
- is_public : channel . context . should_announce ( ) ,
1514
- inbound_htlc_minimum_msat : Some ( channel . context . get_holder_htlc_minimum_msat ( ) ) ,
1515
- inbound_htlc_maximum_msat : channel . context . get_holder_htlc_maximum_msat ( ) ,
1516
- config : Some ( channel . context . config ( ) ) ,
1506
+ user_channel_id : context. get_user_id ( ) ,
1507
+ confirmations_required : context. minimum_depth ( ) ,
1508
+ confirmations : Some ( context. get_funding_tx_confirmations ( best_block_height) ) ,
1509
+ force_close_spend_delay : context. get_counterparty_selected_contest_delay ( ) ,
1510
+ is_outbound : context. is_outbound ( ) ,
1511
+ is_channel_ready : context. is_usable ( ) ,
1512
+ is_usable : context. is_live ( ) ,
1513
+ is_public : context. should_announce ( ) ,
1514
+ inbound_htlc_minimum_msat : Some ( context. get_holder_htlc_minimum_msat ( ) ) ,
1515
+ inbound_htlc_maximum_msat : context. get_holder_htlc_maximum_msat ( ) ,
1516
+ config : Some ( context. config ( ) ) ,
1517
1517
}
1518
1518
}
1519
1519
}
@@ -2091,7 +2091,7 @@ where
2091
2091
let mut peer_state_lock = peer_state_mutex. lock ( ) . unwrap ( ) ;
2092
2092
let peer_state = & mut * peer_state_lock;
2093
2093
for ( _channel_id, channel) in peer_state. channel_by_id . iter ( ) . filter ( f) {
2094
- let details = ChannelDetails :: from_channel ( channel, best_block_height,
2094
+ let details = ChannelDetails :: from_channel_context ( & channel. context , best_block_height,
2095
2095
peer_state. latest_features . clone ( ) ) ;
2096
2096
res. push ( details) ;
2097
2097
}
@@ -2131,7 +2131,7 @@ where
2131
2131
return peer_state. channel_by_id
2132
2132
. iter ( )
2133
2133
. map ( |( _, channel) |
2134
- ChannelDetails :: from_channel ( channel, best_block_height, features. clone ( ) ) )
2134
+ ChannelDetails :: from_channel_context ( & channel. context , best_block_height, features. clone ( ) ) )
2135
2135
. collect ( ) ;
2136
2136
}
2137
2137
vec ! [ ]
0 commit comments