@@ -4059,7 +4059,8 @@ where
40594059 None => {
40604060 let error = format!("Channel with id {} not found for the passed counterparty node_id {}",
40614061 next_hop_channel_id, next_node_id);
4062- log_error!(self.logger, "{} when attempting to forward intercepted HTLC", error);
4062+ let logger = WithContext::from(&self.logger, Some(next_node_id), Some(*next_hop_channel_id));
4063+ log_error!(logger, "{} when attempting to forward intercepted HTLC", error);
40634064 return Err(APIError::ChannelUnavailable {
40644065 err: error
40654066 })
@@ -4147,6 +4148,7 @@ where
41474148
41484149 for (short_chan_id, mut pending_forwards) in forward_htlcs {
41494150 if short_chan_id != 0 {
4151+ let mut forwarding_counterparty = None;
41504152 macro_rules! forwarding_channel_not_found {
41514153 () => {
41524154 for forward_info in pending_forwards.drain(..) {
@@ -4160,7 +4162,8 @@ where
41604162 }) => {
41614163 macro_rules! failure_handler {
41624164 ($msg: expr, $err_code: expr, $err_data: expr, $phantom_ss: expr, $next_hop_unknown: expr) => {
4163- log_info!(self.logger, "Failed to accept/forward incoming HTLC: {}", $msg);
4165+ let logger = WithContext::from(&self.logger, forwarding_counterparty, Some(prev_funding_outpoint.to_channel_id()));
4166+ log_info!(logger, "Failed to accept/forward incoming HTLC: {}", $msg);
41644167
41654168 let htlc_source = HTLCSource::PreviousHopData(HTLCPreviousHopData {
41664169 short_channel_id: prev_short_channel_id,
@@ -4259,6 +4262,7 @@ where
42594262 continue;
42604263 }
42614264 };
4265+ forwarding_counterparty = Some(counterparty_node_id);
42624266 let per_peer_state = self.per_peer_state.read().unwrap();
42634267 let peer_state_mutex_opt = per_peer_state.get(&counterparty_node_id);
42644268 if peer_state_mutex_opt.is_none() {
0 commit comments