Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macro for composing custom message handlers #1832

Merged
merged 4 commits into from
Feb 15, 2023

Commits on Feb 15, 2023

  1. Macro for composing custom message handlers

    BOLT 1 specifies a custom message type range for use with experimental
    or application-specific messages. While a `CustomMessageHandler` can be
    defined to support more than one message type, defining such a handler
    requires a significant amount of boilerplate and can be error prone.
    
    Add a crate exporting a `composite_custom_message_handler` macro for
    easily composing pre-defined custom message handlers. The resulting
    handler can be further composed with other custom message handlers using
    the same macro.
    
    This requires a separate crate since the macro needs to support "or"
    patterns in macro_rules, which is only available in edition 2021.
    
    https://doc.rust-lang.org/edition-guide/rust-2021/or-patterns-macro-rules.html
    
    Otherwise, a crate defining a handler for a set of custom messages could
    not easily be reused with another custom message handler. Doing so would
    require explicitly duplicating the reused handlers type ids, but those
    may change when the crate is updated.
    jkczyz committed Feb 15, 2023
    Configuration menu
    Copy the full SHA
    6e0384e View commit details
    Browse the repository at this point in the history
  2. Fix compilation errors in some doc tests

    These are seen in newer versions of rustc.
    jkczyz committed Feb 15, 2023
    Configuration menu
    Copy the full SHA
    d956634 View commit details
    Browse the repository at this point in the history
  3. Re-write CustomMessageHandler documentation

    Documentation for CustomMessageHandler wasn't clear how it is related to
    PeerManager and contained some grammatical and factual errors. Re-write
    the docs and link to the lightning_custom_message crate.
    jkczyz committed Feb 15, 2023
    Configuration menu
    Copy the full SHA
    c31fe8c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    9876a08 View commit details
    Browse the repository at this point in the history