@@ -367,7 +367,7 @@ impl Responder {
367
367
/// Use when the recipient doesn't need to send back a reply to us.
368
368
pub fn respond ( self ) -> ResponseInstruction {
369
369
ResponseInstruction {
370
- send_path : self . reply_path ,
370
+ destination : Destination :: BlindedPath ( self . reply_path ) ,
371
371
context : None ,
372
372
}
373
373
}
@@ -377,7 +377,7 @@ impl Responder {
377
377
/// Use when the recipient needs to send back a reply to us.
378
378
pub fn respond_with_reply_path ( self , context : MessageContext ) -> ResponseInstruction {
379
379
ResponseInstruction {
380
- send_path : self . reply_path ,
380
+ destination : Destination :: BlindedPath ( self . reply_path ) ,
381
381
context : Some ( context) ,
382
382
}
383
383
}
@@ -386,17 +386,13 @@ impl Responder {
386
386
/// Instructions for how and where to send the response to an onion message.
387
387
#[ derive( Clone ) ]
388
388
pub struct ResponseInstruction {
389
- send_path : BlindedMessagePath ,
389
+ destination : Destination ,
390
390
context : Option < MessageContext > ,
391
391
}
392
392
393
393
impl ResponseInstruction {
394
394
fn into_instructions ( self ) -> MessageSendInstructions {
395
- let destination = Destination :: BlindedPath ( self . send_path ) ;
396
- match self . context {
397
- Some ( context) => MessageSendInstructions :: WithReplyPath { destination, context } ,
398
- None => MessageSendInstructions :: WithoutReplyPath { destination } ,
399
- }
395
+ MessageSendInstructions :: ForReply { instructions : self }
400
396
}
401
397
}
402
398
@@ -425,7 +421,11 @@ pub enum MessageSendInstructions {
425
421
WithoutReplyPath {
426
422
/// The desination where we need to send our message.
427
423
destination : Destination ,
428
- }
424
+ } ,
425
+ /// Indicates that a message is being sent as a reply to a received message.
426
+ ForReply {
427
+ instructions : ResponseInstruction ,
428
+ } ,
429
429
}
430
430
431
431
/// A trait defining behavior for routing an [`OnionMessage`].
@@ -1169,7 +1169,8 @@ where
1169
1169
let ( destination, reply_path) = match instructions {
1170
1170
MessageSendInstructions :: WithSpecifiedReplyPath { destination, reply_path } =>
1171
1171
( destination, Some ( reply_path) ) ,
1172
- MessageSendInstructions :: WithReplyPath { destination, context } => {
1172
+ MessageSendInstructions :: WithReplyPath { destination, context } |
1173
+ MessageSendInstructions :: ForReply { instructions : ResponseInstruction { destination, context : Some ( context) } } => {
1173
1174
match self . create_blinded_path ( context) {
1174
1175
Ok ( reply_path) => ( destination, Some ( reply_path) ) ,
1175
1176
Err ( err) => {
@@ -1182,7 +1183,8 @@ where
1182
1183
}
1183
1184
}
1184
1185
} ,
1185
- MessageSendInstructions :: WithoutReplyPath { destination } =>
1186
+ MessageSendInstructions :: WithoutReplyPath { destination } |
1187
+ MessageSendInstructions :: ForReply { instructions : ResponseInstruction { destination, context : None } } =>
1186
1188
( destination, None ) ,
1187
1189
} ;
1188
1190
0 commit comments