Skip to content

Onion Message Responder creates a circular reference #3178

Closed

Description

@TheBlueMatt

To deal with #2882 we created a Responder, which message handlers can respond() on, then passing the response object back to the OnionMessager. Sadly, this isn't actually really workable as it creates a circular reference - the OnionMessager is typed on the message handler, and passes the messages to it to be handled. But to be able to respond async, we also expect the message handler to hold a reference to the OnionMessenger (and presumably be typed on it). While the type issue itself isn't as big a deal because we can use AOnionMessenger to avoid the type-inexpressibility, we cannot construct the two objects with a circular reference.

For the async gossip verification, we solved this by letting the gossiper take an Optional verifier, then let the user call set_verifier on the gossiper. This would mean the OnionMessenger would need to start taking Optional handlers (rather than IgnoringMessageHandler for no handler).

The other option would be to use the message handler traits, adding a PendingOnionMessage variant for a response or adding a new method to fetch responses ala release_pending_messages. The first here would be my preference.

Activity

  1. added 3 commits that reference this issue on Aug 21, 2024
    3609207
    db9c76a
    5430a09
  2. added 11 commits that reference this issue on Aug 21, 2024
    97d76e0
    0483cb6
    80ac3c7
    00a36f8
    f59c9c0
    d577b24
    ce6a125
    01a31fa
    f43e85e
    d09e732
    47b527a
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