Skip to content

Commit 4cc2065

Browse files
committed
f proper context
1 parent 8646a8c commit 4cc2065

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lightning/src/onion_message/messenger.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -735,10 +735,13 @@ where
735735
&self, contents: T, destination: Destination, reply_path: Option<BlindedPath>,
736736
log_suffix: fmt::Arguments
737737
) -> Result<SendSuccess, SendError> {
738-
let intro_node_logger =
739-
WithContext::from(&self.logger, Some(destination.first_node()), None);
738+
let mut log_wrapper = WithContext::from(&self.logger, None, None);
740739
let result = self.find_path(destination)
741-
.and_then(|path| self.enqueue_onion_message(path, contents, reply_path, log_suffix));
740+
.and_then(|path| {
741+
let first_hop = path.intermediate_nodes.get(0).map(|p| *p);
742+
log_wrapper = WithContext::from(&self.logger, first_hop, None);
743+
self.enqueue_onion_message(path, contents, reply_path, log_suffix)
744+
});
742745

743746
match result.as_ref() {
744747
Err(SendError::GetNodeIdFailed) => {
@@ -751,11 +754,11 @@ where
751754
log_trace!(self.logger, "Failed sending onion message {}: {:?}", log_suffix, e);
752755
},
753756
Ok(SendSuccess::Buffered) => {
754-
log_trace!(intro_node_logger, "Buffered onion message {}", log_suffix);
757+
log_trace!(log_wrapper, "Buffered onion message {}", log_suffix);
755758
},
756759
Ok(SendSuccess::BufferedAwaitingConnection(node_id)) => {
757760
log_trace!(
758-
intro_node_logger,
761+
log_wrapper,
759762
"Buffered onion message waiting on peer connection {}: {}",
760763
log_suffix, node_id
761764
);

0 commit comments

Comments
 (0)