Skip to content

Commit 28f0f67

Browse files
DRY responder instantiation for onion messages.
1 parent ed9b18e commit 28f0f67

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
@@ -1436,25 +1436,19 @@ where
14361436
"Received an onion message with path_id {:02x?} and {} reply_path: {:?}",
14371437
path_id, if reply_path.is_some() { "a" } else { "no" }, message);
14381438

1439+
let responder = reply_path.map(
1440+
|reply_path| Responder::new(reply_path, path_id)
1441+
);
14391442
match message {
14401443
ParsedOnionMessageContents::Offers(msg) => {
1441-
let responder = reply_path.map(
1442-
|reply_path| Responder::new(reply_path, path_id)
1443-
);
14441444
let response_instructions = self.offers_handler.handle_message(msg, responder);
14451445
let _ = self.handle_onion_message_response(response_instructions);
14461446
},
14471447
ParsedOnionMessageContents::AsyncPayments(msg) => {
1448-
let responder = reply_path.map(
1449-
|reply_path| Responder::new(reply_path, path_id)
1450-
);
14511448
let response_instructions = self.async_payments_handler.handle_message(msg, responder);
14521449
let _ = self.handle_onion_message_response(response_instructions);
14531450
},
14541451
ParsedOnionMessageContents::Custom(msg) => {
1455-
let responder = reply_path.map(
1456-
|reply_path| Responder::new(reply_path, path_id)
1457-
);
14581452
let response_instructions = self.custom_handler.handle_custom_message(msg, responder);
14591453
let _ = self.handle_onion_message_response(response_instructions);
14601454
},

0 commit comments

Comments
 (0)