Skip to content

Commit

Permalink
f proper context
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBlueMatt committed Mar 12, 2024
1 parent 8646a8c commit 4cc2065
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lightning/src/onion_message/messenger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -735,10 +735,13 @@ where
&self, contents: T, destination: Destination, reply_path: Option<BlindedPath>,
log_suffix: fmt::Arguments
) -> Result<SendSuccess, SendError> {
let intro_node_logger =
WithContext::from(&self.logger, Some(destination.first_node()), None);
let mut log_wrapper = WithContext::from(&self.logger, None, None);
let result = self.find_path(destination)
.and_then(|path| self.enqueue_onion_message(path, contents, reply_path, log_suffix));
.and_then(|path| {
let first_hop = path.intermediate_nodes.get(0).map(|p| *p);
log_wrapper = WithContext::from(&self.logger, first_hop, None);
self.enqueue_onion_message(path, contents, reply_path, log_suffix)
});

match result.as_ref() {
Err(SendError::GetNodeIdFailed) => {
Expand All @@ -751,11 +754,11 @@ where
log_trace!(self.logger, "Failed sending onion message {}: {:?}", log_suffix, e);
},
Ok(SendSuccess::Buffered) => {
log_trace!(intro_node_logger, "Buffered onion message {}", log_suffix);
log_trace!(log_wrapper, "Buffered onion message {}", log_suffix);
},
Ok(SendSuccess::BufferedAwaitingConnection(node_id)) => {
log_trace!(
intro_node_logger,
log_wrapper,
"Buffered onion message waiting on peer connection {}: {}",
log_suffix, node_id
);
Expand Down

0 comments on commit 4cc2065

Please sign in to comment.