Skip to content

CustomOnionMessageHandler::handle_message doesn't expose the reply_path #2882

Closed

Description

@TheBlueMatt

I'm trying to implement an onion message handler that does some work async and then eventually replies to an onion message. However, handle_message currently only exposes the message itself but not the reply path, which would be needed to be able to respond async. To avoid cloneing the BlindedPath in such a case, maybe it makes sense to drop the whole reply-inline logic and force users to reply via release_pending_custom_messages?

Activity

  1. jkczyz commented on Feb 7, 2024

    @jkczyz
    Contributor

    Hmm... possibly though it would be nice to have some optionality here. We could pass the handler an object that has methods like:

    • respond for handling the current case
    • respond_with_reply_path for giving a reply path in the response (needed for proper invoice error handling still)
    • defer (or something) to consume the object and obtain the reply path, path_id, etc.
  2. TheBlueMatt commented on Feb 7, 2024

    @TheBlueMatt
    CollaboratorAuthor

    That seems sensible, and then the method would return a PendingOnionMessage<Self::CustomMessage> rather than a Self::CustomMessage?

  3. jkczyz commented on Feb 7, 2024

    @jkczyz
    Contributor

    Not 100% sure. I was thinking those first two methods would essentially act as callbacks to OnionMessenger::handle_onion_message_response. (Note that we'll need the second method for OffersMessageHandler when responding with an invoice plus reply path, so this isn't only applicable to custom messages.) Then the message handler would no longer have a return value since responding async wouldn't require one. But I can see there being other ways of formulating this.

  4. TheBlueMatt commented on Feb 9, 2024

    @TheBlueMatt
    CollaboratorAuthor

    Yea, I don't really have much of an opinion on how this should look, any of those seem reasonable to me.

  5. shaavan commented on Feb 15, 2024

    @shaavan
    Member

    Quick heads up, I'm actively tackling this issue now. Will update as soon as I make some good progress!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions