@@ -6712,6 +6712,9 @@ where
67126712 &self, intercept_id: InterceptId, next_hop_channel_id: &ChannelId, next_node_id: PublicKey,
67136713 amt_to_forward_msat: u64,
67146714 ) -> Result<(), APIError> {
6715+ let entry_logger = WithContext::from(&self.logger, Some(next_node_id), Some(*next_hop_channel_id), None);
6716+ log_info!(entry_logger, "forward_intercepted_htlc called: intercept_id {:?} next_hop_channel_id {} next_node_id {} amt_to_forward_msat {}",
6717+ intercept_id, next_hop_channel_id, next_node_id, amt_to_forward_msat);
67156718 let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);
67166719
67176720 let outbound_scid_alias = {
@@ -11265,38 +11268,43 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1126511268 // Pull this now to avoid introducing a lock order with `forward_htlcs`.
1126611269 let is_our_scid = self.short_to_chan_info.read().unwrap().contains_key(&scid);
1126711270
11268- let payment_hash = forward_info.payment_hash;
11269- let logger = WithContext::from(
11270- &self.logger,
11271- None,
11272- Some(prev_channel_id),
11273- Some(payment_hash),
11271+
11272+ let payment_hash = forward_info.payment_hash;
11273+ let is_intercept = fake_scid::is_valid_intercept(&self.fake_scid_rand_bytes, scid, &self.chain_hash);
11274+ let is_phantom = fake_scid::is_valid_phantom(&self.fake_scid_rand_bytes, scid, &self.chain_hash);
11275+ let logger = WithContext::from(
11276+ &self.logger,
11277+ None,
11278+ Some(prev_channel_id),
11279+ Some(payment_hash),
11280+ );
11281+ log_debug!(logger, "Forward HTLC decision: scid {} is_our_scid={} is_intercept={} is_phantom={} incoming_amt_msat={:?} outgoing_amt_msat={} prev_short_channel_id={} prev_channel_id={}",
11282+ scid, is_our_scid, is_intercept, is_phantom, forward_info.incoming_amt_msat, forward_info.outgoing_amt_msat, prev_outbound_scid_alias, prev_channel_id);
11283+ let pending_add = PendingAddHTLCInfo {
11284+ prev_outbound_scid_alias,
11285+ prev_counterparty_node_id,
11286+ prev_funding_outpoint,
11287+ prev_channel_id,
11288+ prev_htlc_id,
11289+ prev_user_channel_id,
11290+ forward_info,
11291+ };
11292+ let mut fail_intercepted_htlc = |pending_add: PendingAddHTLCInfo| {
11293+ let htlc_source =
11294+ HTLCSource::PreviousHopData(pending_add.htlc_previous_hop_data());
11295+ let reason = HTLCFailReason::from_failure_code(
11296+ LocalHTLCFailureReason::UnknownNextPeer,
1127411297 );
11275- let pending_add = PendingAddHTLCInfo {
11276- prev_outbound_scid_alias,
11277- prev_counterparty_node_id,
11278- prev_funding_outpoint,
11279- prev_channel_id,
11280- prev_htlc_id,
11281- prev_user_channel_id,
11282- forward_info,
11283- };
11284- let mut fail_intercepted_htlc = |pending_add: PendingAddHTLCInfo| {
11285- let htlc_source =
11286- HTLCSource::PreviousHopData(pending_add.htlc_previous_hop_data());
11287- let reason = HTLCFailReason::from_failure_code(
11288- LocalHTLCFailureReason::UnknownNextPeer,
11289- );
11290- let failure_type = HTLCHandlingFailureType::InvalidForward {
11291- requested_forward_scid: scid,
11292- };
11293- failed_intercept_forwards.push((
11294- htlc_source,
11295- payment_hash,
11296- reason,
11297- failure_type,
11298- ));
11298+ let failure_type = HTLCHandlingFailureType::InvalidForward {
11299+ requested_forward_scid: scid,
1129911300 };
11301+ failed_intercept_forwards.push((
11302+ htlc_source,
11303+ payment_hash,
11304+ reason,
11305+ failure_type,
11306+ ));
11307+ };
1130011308
1130111309 // In the case that we have an HTLC that we're supposed to hold onto until the
1130211310 // recipient comes online *and* the outbound scid is encoded as
@@ -11391,6 +11399,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1139111399 }
1139211400
1139311401 if !new_intercept_events.is_empty() {
11402+ log_info!(WithContext::from(&self.logger, None, None, None), "Queueing {} HTLCIntercepted event(s)", new_intercept_events.len());
1139411403 let mut events = self.pending_events.lock().unwrap();
1139511404 events.append(&mut new_intercept_events);
1139611405 }
0 commit comments