Skip to content

Commit 94e6b47

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 1ee0a67 commit 94e6b47

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lightning/src/onion_message/messenger.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ impl Responder {
367367
/// Use when the recipient doesn't need to send back a reply to us.
368368
pub fn respond<T: OnionMessageContents>(self, response: T) -> Option<(T, MessageSendInstructions)> {
369369
Some((response, MessageSendInstructions::WithoutReplyPath {
370-
send_path: self.reply_path,
370+
destination: Destination::BlindedPath(self.reply_path),
371371
}))
372372
}
373373

@@ -376,7 +376,7 @@ impl Responder {
376376
/// Use when the recipient needs to send back a reply to us.
377377
pub fn respond_with_reply_path<T: OnionMessageContents>(self, response: T, context: MessageContext) -> Option<(T, MessageSendInstructions)> {
378378
Some((response, MessageSendInstructions::WithReplyPath {
379-
send_path: self.reply_path,
379+
destination: Destination::BlindedPath(self.reply_path),
380380
context: context,
381381
}))
382382
}
@@ -389,7 +389,7 @@ pub enum MessageSendInstructions {
389389
/// respond.
390390
WithReplyPath {
391391
/// The desination where we need to send our message.
392-
send_path: BlindedMessagePath,
392+
destination: Destination,
393393
/// The context to include in the reply path we'll give the recipient so they can respond
394394
/// to us.
395395
context: MessageContext,
@@ -398,7 +398,7 @@ pub enum MessageSendInstructions {
398398
/// recipient from responding.
399399
WithoutReplyPath {
400400
/// The desination where we need to send our message.
401-
send_path: BlindedMessagePath,
401+
destination: Destination,
402402
}
403403
}
404404

@@ -1324,9 +1324,9 @@ where
13241324
pub fn handle_onion_message_response<T: OnionMessageContents>(
13251325
&self, response_message: T, response: MessageSendInstructions,
13261326
) -> Result<Option<SendSuccess>, SendError> {
1327-
let (response_path, context) = match response {
1328-
MessageSendInstructions::WithReplyPath { send_path, context } => (send_path, Some(context)),
1329-
MessageSendInstructions::WithoutReplyPath { send_path } => (send_path, None),
1327+
let (destination, context) = match response {
1328+
MessageSendInstructions::WithReplyPath { destination, context } => (destination, Some(context)),
1329+
MessageSendInstructions::WithoutReplyPath { destination } => (destination, None),
13301330
};
13311331

13321332
let message_type = response_message.msg_type();
@@ -1345,7 +1345,7 @@ where
13451345
} else { None };
13461346

13471347
self.find_path_and_enqueue_onion_message(
1348-
response_message, Destination::BlindedPath(response_path), reply_path,
1348+
response_message, destination, reply_path,
13491349
format_args!(
13501350
"when responding with {} to an onion message",
13511351
message_type,

0 commit comments

Comments
 (0)