Skip to content

Commit 41567f4

Browse files
committed
Refactor handle_onion_message_response parameters
This change provides flexibility for future modifications that may require access to message_type, and path_id parameters within the function.
1 parent 704074c commit 41567f4

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

lightning/src/onion_message/messenger.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -888,11 +888,16 @@ where
888888
}
889889

890890
fn handle_onion_message_response<T: OnionMessageContents>(
891-
&self, response: ResponseInstruction<T>, log_suffix: fmt::Arguments
891+
&self, response: ResponseInstruction<T>, message_type: &str, path_id: Option<[u8; 32]>
892892
) {
893893
if let ResponseInstruction::WithoutReplyPath(response) = response {
894894
let _ = self.find_path_and_enqueue_onion_message(
895-
response.message, Destination::BlindedPath(response.reply_path), None, log_suffix
895+
response.message, Destination::BlindedPath(response.reply_path), None,
896+
format_args!(
897+
"when responding to {} onion message with path_id {:02x?}",
898+
message_type,
899+
path_id
900+
)
896901
);
897902
}
898903
}
@@ -978,20 +983,12 @@ where
978983
ParsedOnionMessageContents::Offers(msg) => {
979984
let responder = reply_path.map(|path| Responder::new(path));
980985
let response_instructions = self.offers_handler.handle_message(msg, responder);
981-
self.handle_onion_message_response(response_instructions, format_args!(
982-
"when responding to {} onion message with path_id {:02x?}",
983-
message_type,
984-
path_id
985-
))
986+
self.handle_onion_message_response(response_instructions, message_type, path_id);
986987
},
987988
ParsedOnionMessageContents::Custom(msg) => {
988989
let responder = reply_path.map(|path| Responder::new(path));
989990
let response_instructions = self.custom_handler.handle_custom_message(msg, responder);
990-
self.handle_onion_message_response(response_instructions, format_args!(
991-
"when responding to {} onion message with path_id {:02x?}",
992-
message_type,
993-
path_id
994-
))
991+
self.handle_onion_message_response(response_instructions, message_type, path_id);
995992
},
996993
}
997994
},

0 commit comments

Comments
 (0)