Skip to content

Commit 377116a

Browse files
committed
Add peer_id and channel_id to logging for utils.rs
1 parent 8748f91 commit 377116a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lightning-invoice/src/utils.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ where
236236
let mut phantom_hints: Vec<Vec<RouteHint>> = Vec::new();
237237

238238
for PhantomRouteHints { channels, phantom_scid, real_node_pubkey } in phantom_route_hints {
239-
log_trace!(logger, None, None, "Generating phantom route hints for node {}",
239+
log_trace!(logger, Some(real_node_pubkey), None, "Generating phantom route hints for node {}",
240240
log_pubkey!(real_node_pubkey));
241241
let mut route_hints = sort_and_filter_channels(channels, amt_msat, &logger);
242242

@@ -587,7 +587,7 @@ fn sort_and_filter_channels<L: Deref>(
587587
log_trace!(logger, None, None, "Considering {} channels for invoice route hints", channels.len());
588588
for channel in channels.into_iter().filter(|chan| chan.is_channel_ready) {
589589
if channel.get_inbound_payment_scid().is_none() || channel.counterparty.forwarding_info.is_none() {
590-
log_trace!(logger, None, None, "Ignoring channel {} for invoice route hints", log_bytes!(channel.channel_id));
590+
log_trace!(logger, Some(channel.counterparty.node_id), Some(channel.channel_id), "Ignoring channel {} for invoice route hints", log_bytes!(channel.channel_id));
591591
continue;
592592
}
593593

@@ -600,15 +600,15 @@ fn sort_and_filter_channels<L: Deref>(
600600
} else {
601601
// If any public channel exists, return no hints and let the sender
602602
// look at the public channels instead.
603-
log_trace!(logger, None, None, "Not including channels in invoice route hints on account of public channel {}",
603+
log_trace!(logger, Some(channel.counterparty.node_id), Some(channel.channel_id), "Not including channels in invoice route hints on account of public channel {}",
604604
log_bytes!(channel.channel_id));
605605
return vec![]
606606
}
607607
}
608608

609609
if channel.inbound_capacity_msat >= min_inbound_capacity {
610610
if !min_capacity_channel_exists {
611-
log_trace!(logger, None, None, "Channel with enough inbound capacity exists for invoice route hints");
611+
log_trace!(logger, Some(channel.counterparty.node_id), Some(channel.channel_id), "Channel with enough inbound capacity exists for invoice route hints");
612612
min_capacity_channel_exists = true;
613613
}
614614

@@ -618,7 +618,7 @@ fn sort_and_filter_channels<L: Deref>(
618618
}
619619

620620
if channel.is_usable && !online_channel_exists {
621-
log_trace!(logger, None, None, "Channel with connected peer exists for invoice route hints");
621+
log_trace!(logger, Some(channel.counterparty.node_id), Some(channel.channel_id), "Channel with connected peer exists for invoice route hints");
622622
online_channel_exists = true;
623623
}
624624

@@ -703,14 +703,14 @@ fn sort_and_filter_channels<L: Deref>(
703703
} else { true };
704704

705705
if include_channel {
706-
log_trace!(logger, None, None, "Including channel {} in invoice route hints",
706+
log_trace!(logger, Some(channel.counterparty.node_id), Some(channel.channel_id), "Including channel {} in invoice route hints",
707707
log_bytes!(channel.channel_id));
708708
} else if !has_enough_capacity {
709-
log_trace!(logger, None, None, "Ignoring channel {} without enough capacity for invoice route hints",
709+
log_trace!(logger, Some(channel.counterparty.node_id), Some(channel.channel_id), "Ignoring channel {} without enough capacity for invoice route hints",
710710
log_bytes!(channel.channel_id));
711711
} else {
712712
debug_assert!(!channel.is_usable || (has_pub_unconf_chan && !channel.is_public));
713-
log_trace!(logger, None, None, "Ignoring channel {} with disconnected peer",
713+
log_trace!(logger, Some(channel.counterparty.node_id), Some(channel.channel_id), "Ignoring channel {} with disconnected peer",
714714
log_bytes!(channel.channel_id));
715715
}
716716

0 commit comments

Comments
 (0)