Skip to content

Commit 33e2309

Browse files
committed
Give MessageSendInstructions any Destination, not only Blinded
In the next commit we'll use `MessageSendInstructions` for all messages, so it needs the ability to take any `Destination`, not only a `Destination::Blinded`.
1 parent 8e358c9 commit 33e2309

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lightning/src/onion_message/messenger.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,10 @@ pub struct ResponseInstruction {
392392

393393
impl ResponseInstruction {
394394
fn into_instructions(self) -> MessageSendInstructions {
395-
let send_path = self.send_path;
395+
let destination = Destination::BlindedPath(self.send_path);
396396
match self.context {
397-
Some(context) => MessageSendInstructions::WithReplyPath { send_path, context },
398-
None => MessageSendInstructions::WithoutReplyPath { send_path },
397+
Some(context) => MessageSendInstructions::WithReplyPath { destination, context },
398+
None => MessageSendInstructions::WithoutReplyPath { destination },
399399
}
400400
}
401401
}
@@ -407,7 +407,7 @@ pub enum MessageSendInstructions {
407407
/// respond.
408408
WithReplyPath {
409409
/// The desination where we need to send our message.
410-
send_path: BlindedMessagePath,
410+
destination: Destination,
411411
/// The context to include in the reply path we'll give the recipient so they can respond
412412
/// to us.
413413
context: MessageContext,
@@ -416,7 +416,7 @@ pub enum MessageSendInstructions {
416416
/// recipient from responding.
417417
WithoutReplyPath {
418418
/// The desination where we need to send our message.
419-
send_path: BlindedMessagePath,
419+
destination: Destination,
420420
}
421421
}
422422

@@ -1342,9 +1342,9 @@ where
13421342
pub fn handle_onion_message_response<T: OnionMessageContents>(
13431343
&self, response: T, instructions: ResponseInstruction,
13441344
) -> Result<Option<SendSuccess>, SendError> {
1345-
let (response_path, context) = match instructions.into_instructions() {
1346-
MessageSendInstructions::WithReplyPath { send_path, context } => (send_path, Some(context)),
1347-
MessageSendInstructions::WithoutReplyPath { send_path } => (send_path, None),
1345+
let (destination, context) = match instructions.into_instructions() {
1346+
MessageSendInstructions::WithReplyPath { destination, context } => (destination, Some(context)),
1347+
MessageSendInstructions::WithoutReplyPath { destination } => (destination, None),
13481348
};
13491349

13501350
let message_type = response.msg_type();
@@ -1363,7 +1363,7 @@ where
13631363
} else { None };
13641364

13651365
self.find_path_and_enqueue_onion_message(
1366-
response, Destination::BlindedPath(response_path), reply_path,
1366+
response, destination, reply_path,
13671367
format_args!(
13681368
"when responding with {} to an onion message",
13691369
message_type,

0 commit comments

Comments
 (0)