Skip to content

Commit 45fb572

Browse files
committed
f - add RouteNotFound error
1 parent b6e60e6 commit 45fb572

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
@@ -236,6 +236,8 @@ pub enum ResponseError {
236236
GetNodeIdFailed,
237237
/// No reply path in the onion message.
238238
NoReplyPath,
239+
/// Could not find a route to the destination.
240+
RouteNotFound,
239241
/// Failed to send the reply.
240242
Sending(SendError),
241243
}
@@ -350,7 +352,16 @@ where
350352
},
351353
};
352354

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

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

0 commit comments

Comments
 (0)