Skip to content

Commit 3078059

Browse files
committed
f - add RouteNotFound error
1 parent 546f72b commit 3078059

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lightning/src/onion_message/messenger.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ pub enum ResponseError {
234234
GetNodeIdFailed,
235235
/// No reply path in the onion message.
236236
NoReplyPath,
237+
/// Could not find a route to the destination.
238+
RouteNotFound,
237239
/// Failed to send the reply.
238240
Sending(SendError),
239241
}
@@ -348,7 +350,16 @@ where
348350
},
349351
};
350352

351-
let intermediate_nodes = self.message_router.find_route(&sender, &destination);
353+
let intermediate_nodes = match self.message_router.find_route(&sender, &destination) {
354+
Some(intermediate_nodes) => intermediate_nodes,
355+
None => {
356+
log_info!(
357+
self.logger, "No route to respond to onion message with path_id {:02x?}",
358+
path_id
359+
);
360+
return error_handler.handle_response_error(ResponseError::RouteNotFound);
361+
},
362+
};
352363

353364
log_info!(self.logger, "Responding to onion message with path_id {:02x?}", path_id);
354365

0 commit comments

Comments
 (0)