@@ -1192,6 +1192,12 @@ where
11921192 amt_to_forward_msat,
11931193 channel_count
11941194 } ) => {
1195+ let event_start = std:: time:: Instant :: now ( ) ;
1196+ log_info ! ( self . logger,
1197+ "[LSPS4] OpenChannel event received for peer {} - amt_to_forward: {}msat, channel_count: {}" ,
1198+ their_network_key, amt_to_forward_msat, channel_count
1199+ ) ;
1200+
11951201 if self . liquidity_manager . lsps4_service_handler ( ) . is_none ( ) {
11961202 log_error ! ( self . logger, "Failed to handle LSPS4ServiceEvent as LSPS4 liquidity service was not configured." , ) ;
11971203 return ;
@@ -1213,13 +1219,11 @@ where
12131219 if let Some ( peer) = peer_manager. peer_by_node_id ( & their_network_key) {
12141220 peer. init_features
12151221 } else {
1216- // TODO: We just silently fail here. Eventually we will need to remember
1217- // the pending requests and regularly retry opening the channel until we
1218- // succeed.
12191222 log_error ! (
12201223 self . logger,
1221- "Failed to open LSPS4 channel to {} due to peer not being not connected." ,
1224+ "Failed to open LSPS4 channel to {} due to peer not being not connected (after {}ms) ." ,
12221225 their_network_key,
1226+ event_start. elapsed( ) . as_millis( ) ,
12231227 ) ;
12241228 return ;
12251229 }
@@ -1229,6 +1233,11 @@ where
12291233 return ;
12301234 } ;
12311235
1236+ log_info ! ( self . logger,
1237+ "[LSPS4] OpenChannel: peer {} connected, checking wallet balance (after {}ms)..." ,
1238+ their_network_key, event_start. elapsed( ) . as_millis( )
1239+ ) ;
1240+
12321241 // Fail if we have insufficient onchain funds available.
12331242 let over_provisioning_msat = ( amt_to_forward_msat
12341243 * service_config. channel_over_provisioning_ppm as u64 )
@@ -1251,6 +1260,7 @@ where
12511260 let cur_anchor_reserve_sats =
12521261 total_anchor_channels_reserve_sats ( & self . channel_manager , & self . config ) ;
12531262 let w = Arc :: clone ( & self . wallet ) ;
1263+ let wallet_start = std:: time:: Instant :: now ( ) ;
12541264 let spendable_amount_sats = tokio:: task:: spawn_blocking ( move || {
12551265 w. get_spendable_amount_sats ( cur_anchor_reserve_sats)
12561266 } )
@@ -1260,6 +1270,11 @@ where
12601270 Err ( Error :: WalletOperationFailed )
12611271 } )
12621272 . unwrap_or ( 0 ) ;
1273+ let wallet_ms = wallet_start. elapsed ( ) . as_millis ( ) ;
1274+ log_info ! ( self . logger,
1275+ "[LSPS4] OpenChannel: wallet check took {}ms for peer {} - spendable: {}sats, channel_amount: {}sats (total event time: {}ms)" ,
1276+ wallet_ms, their_network_key, spendable_amount_sats, channel_amount_sats, event_start. elapsed( ) . as_millis( )
1277+ ) ;
12631278 let required_funds_sats = channel_amount_sats
12641279 + self . config . anchor_channels_config . as_ref ( ) . map_or ( 0 , |c| {
12651280 if init_features. requires_anchors_zero_fee_htlc_tx ( )
@@ -1272,18 +1287,14 @@ where
12721287 } ) ;
12731288 if spendable_amount_sats < required_funds_sats {
12741289 log_error ! ( self . logger,
1275- "Unable to create channel due to insufficient funds. Available: {}sats, Required: {}sats" ,
1276- spendable_amount_sats, channel_amount_sats
1290+ "Unable to create channel due to insufficient funds. Available: {}sats, Required: {}sats (after {}ms) " ,
1291+ spendable_amount_sats, channel_amount_sats, event_start . elapsed ( ) . as_millis ( )
12771292 ) ;
1278- // TODO: We just silently fail here. Eventually we will need to remember
1279- // the pending requests and regularly retry opening the channel until we
1280- // succeed.
12811293 return ;
12821294 }
12831295
12841296 let mut config = self . channel_manager . get_current_config ( ) . clone ( ) ;
12851297
1286-
12871298 // We set these LSP-specific values during Node building, here we're making sure it's actually set.
12881299 debug_assert_eq ! (
12891300 config
@@ -1301,7 +1312,6 @@ where
13011312 config. channel_handshake_config . min_their_channel_reserve_satoshis = 0 ;
13021313 config. channel_handshake_config . their_channel_reserve_proportional_millionths = 0 ;
13031314
1304- // TODO: does LSPS4 service need to track this? seems like no?
13051315 let user_channel_id = 0 ;
13061316
13071317 match self . channel_manager . create_channel (
@@ -1312,16 +1322,20 @@ where
13121322 None ,
13131323 Some ( config) ,
13141324 ) {
1315- Ok ( _) => { } ,
1325+ Ok ( _) => {
1326+ log_info ! ( self . logger,
1327+ "[LSPS4] OpenChannel: successfully opened channel to {} for {}sats (total event time: {}ms)" ,
1328+ their_network_key, channel_amount_sats, event_start. elapsed( ) . as_millis( )
1329+ ) ;
1330+ } ,
13161331 Err ( e) => {
1317- // TODO: We just silently fail here. Eventually we will need to remember
1318- // the pending requests and regularly retry opening the channel until we
1319- // succeed.
13201332 log_error ! (
13211333 self . logger,
1322- "Failed to open LSPS4 channel to {}: {:?}" ,
1334+ "Failed to open LSPS4 channel to {} for {}sats : {:?} (after {}ms) " ,
13231335 their_network_key,
1324- e
1336+ channel_amount_sats,
1337+ e,
1338+ event_start. elapsed( ) . as_millis( )
13251339 ) ;
13261340 return ;
13271341 } ,
0 commit comments