Skip to content

Commit 30529f2

Browse files
DRY responder instantiation for onion messages.
1 parent 51ac009 commit 30529f2

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

lightning/src/onion_message/messenger.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,25 +1435,19 @@ where
14351435
"Received an onion message with path_id {:02x?} and {} reply_path: {:?}",
14361436
path_id, if reply_path.is_some() { "a" } else { "no" }, message);
14371437

1438+
let responder = reply_path.map(
1439+
|reply_path| Responder::new(reply_path, path_id)
1440+
);
14381441
match message {
14391442
ParsedOnionMessageContents::Offers(msg) => {
1440-
let responder = reply_path.map(
1441-
|reply_path| Responder::new(reply_path, path_id)
1442-
);
14431443
let response_instructions = self.offers_handler.handle_message(msg, responder);
14441444
let _ = self.handle_onion_message_response(response_instructions);
14451445
},
14461446
ParsedOnionMessageContents::AsyncPayments(msg) => {
1447-
let responder = reply_path.map(
1448-
|reply_path| Responder::new(reply_path, path_id)
1449-
);
14501447
let response_instructions = self.async_payments_handler.handle_message(msg, responder);
14511448
let _ = self.handle_onion_message_response(response_instructions);
14521449
},
14531450
ParsedOnionMessageContents::Custom(msg) => {
1454-
let responder = reply_path.map(
1455-
|reply_path| Responder::new(reply_path, path_id)
1456-
);
14571451
let response_instructions = self.custom_handler.handle_custom_message(msg, responder);
14581452
let _ = self.handle_onion_message_response(response_instructions);
14591453
},

0 commit comments

Comments
 (0)