Skip to content

Feature Request: Make onion_utils Public Behind a Feature Flag #4247

@erickcestari

Description

@erickcestari

Currently, the onion_utils module in rust-lightning is private and not accessible to library users. This module contains useful structs and functions for working with onion routing that could benefit developers building custom Lightning implementations or tools.

Use Case

Developers who need direct access to onion-related utilities for:

  • Custom payment routing logic
  • Advanced onion packet manipulation
  • Testing and development of Lightning-adjacent tools
  • Building specialized Lightning applications that need lower-level onion routing primitives

Proposed Solution

Expose the onion_utils module and it internal structs and functions publicly behind an opt-in feature flag (e.g., expose-onion-utils or advanced-routing)

  • Make the module conditionally public with a feature flag
  • Convert internal pub(crate) items to pub

Real-World Use Case

I've been using a fork to implement a new target for bitcoinfuzz to do differential fuzzing on onion decoding. I've made some internal structs public and the whole module public using a feature flag.
Fork demonstrating the changes: main...erickcestari:rust-lightning:expose-onion-utils

Some questions

  1. Would you be open to accepting a PR with these changes?
  2. What would be an appropriate feature flag name?
  3. Should the feature be marked as unstable/experimental in documentation?
  4. Are there specific items in onion_utils that should remain private?

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