From c3b518845d937c058e40cb1f24c4931e6bb34395 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 13 Feb 2024 00:07:22 +0000 Subject: [PATCH] f pre-wrap --- lightning/src/onion_message/messenger.rs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/lightning/src/onion_message/messenger.rs b/lightning/src/onion_message/messenger.rs index fe0761ff901..7d4dca3753c 100644 --- a/lightning/src/onion_message/messenger.rs +++ b/lightning/src/onion_message/messenger.rs @@ -914,10 +914,11 @@ where CMH::Target: CustomOnionMessageHandler, { fn handle_onion_message(&self, peer_node_id: &PublicKey, msg: &OnionMessage) { + let logger = WithContext::from(&self.logger, Some(*peer_node_id), None); match self.peel_onion_message(msg) { Ok(PeeledOnion::Receive(message, path_id, reply_path)) => { log_trace!( - WithContext::from(&self.logger, Some(*peer_node_id), None), + logger, "Received an onion message with path_id {:02x?} and {} reply_path: {:?}", path_id, if reply_path.is_some() { "a" } else { "no" }, message); @@ -946,7 +947,7 @@ where let mut message_recipients = self.message_recipients.lock().unwrap(); if outbound_buffer_full(&next_node_id, &message_recipients) { log_trace!( - WithContext::from(&self.logger, Some(*peer_node_id), None), + logger, "Dropping forwarded onion message to peer {}: outbound buffer full", next_node_id); return @@ -962,14 +963,11 @@ where e.get(), OnionMessageRecipient::ConnectedPeer(..) ) => { e.get_mut().enqueue_message(onion_message); - log_trace!( - WithContext::from(&self.logger, Some(*peer_node_id), None), - "Forwarding an onion message to peer {}", - next_node_id); + log_trace!(logger, "Forwarding an onion message to peer {}", next_node_id); }, _ => { log_trace!( - WithContext::from(&self.logger, Some(*peer_node_id), None), + logger, "Dropping forwarded onion message to disconnected peer {}", next_node_id); return @@ -977,10 +975,7 @@ where } }, Err(e) => { - log_error!( - WithContext::from(&self.logger, Some(*peer_node_id), None), - "Failed to process onion message {:?}", - e); + log_error!(logger, "Failed to process onion message {:?}", e); } } }