Skip to content

Commit 282b632

Browse files
Revert "chore: add diagnostic logging to LSPS4 OpenChannel event handler"
This reverts commit c2aabdb.
1 parent dd6f3d9 commit 282b632

1 file changed

Lines changed: 17 additions & 31 deletions

File tree

src/liquidity.rs

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,12 +1192,6 @@ 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-
12011195
if self.liquidity_manager.lsps4_service_handler().is_none() {
12021196
log_error!(self.logger, "Failed to handle LSPS4ServiceEvent as LSPS4 liquidity service was not configured.",);
12031197
return;
@@ -1219,11 +1213,13 @@ where
12191213
if let Some(peer) = peer_manager.peer_by_node_id(&their_network_key) {
12201214
peer.init_features
12211215
} 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.
12221219
log_error!(
12231220
self.logger,
1224-
"Failed to open LSPS4 channel to {} due to peer not being not connected (after {}ms).",
1221+
"Failed to open LSPS4 channel to {} due to peer not being not connected.",
12251222
their_network_key,
1226-
event_start.elapsed().as_millis(),
12271223
);
12281224
return;
12291225
}
@@ -1233,11 +1229,6 @@ where
12331229
return;
12341230
};
12351231

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-
12411232
// Fail if we have insufficient onchain funds available.
12421233
let over_provisioning_msat = (amt_to_forward_msat
12431234
* service_config.channel_over_provisioning_ppm as u64)
@@ -1260,7 +1251,6 @@ where
12601251
let cur_anchor_reserve_sats =
12611252
total_anchor_channels_reserve_sats(&self.channel_manager, &self.config);
12621253
let w = Arc::clone(&self.wallet);
1263-
let wallet_start = std::time::Instant::now();
12641254
let spendable_amount_sats = tokio::task::spawn_blocking(move || {
12651255
w.get_spendable_amount_sats(cur_anchor_reserve_sats)
12661256
})
@@ -1270,11 +1260,6 @@ where
12701260
Err(Error::WalletOperationFailed)
12711261
})
12721262
.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-
);
12781263
let required_funds_sats = channel_amount_sats
12791264
+ self.config.anchor_channels_config.as_ref().map_or(0, |c| {
12801265
if init_features.requires_anchors_zero_fee_htlc_tx()
@@ -1287,14 +1272,18 @@ where
12871272
});
12881273
if spendable_amount_sats < required_funds_sats {
12891274
log_error!(self.logger,
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()
1275+
"Unable to create channel due to insufficient funds. Available: {}sats, Required: {}sats",
1276+
spendable_amount_sats, channel_amount_sats
12921277
);
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.
12931281
return;
12941282
}
12951283

12961284
let mut config = self.channel_manager.get_current_config().clone();
12971285

1286+
12981287
// We set these LSP-specific values during Node building, here we're making sure it's actually set.
12991288
debug_assert_eq!(
13001289
config
@@ -1312,6 +1301,7 @@ where
13121301
config.channel_handshake_config.min_their_channel_reserve_satoshis = 0;
13131302
config.channel_handshake_config.their_channel_reserve_proportional_millionths = 0;
13141303

1304+
// TODO: does LSPS4 service need to track this? seems like no?
13151305
let user_channel_id = 0;
13161306

13171307
match self.channel_manager.create_channel(
@@ -1322,20 +1312,16 @@ where
13221312
None,
13231313
Some(config),
13241314
) {
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-
},
1315+
Ok(_) => {},
13311316
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.
13321320
log_error!(
13331321
self.logger,
1334-
"Failed to open LSPS4 channel to {} for {}sats: {:?} (after {}ms)",
1322+
"Failed to open LSPS4 channel to {}: {:?}",
13351323
their_network_key,
1336-
channel_amount_sats,
1337-
e,
1338-
event_start.elapsed().as_millis()
1324+
e
13391325
);
13401326
return;
13411327
},

0 commit comments

Comments
 (0)