Skip to content

Commit

Permalink
Introduce BlindedPathParams
Browse files Browse the repository at this point in the history
1. Added a new struct called `BlindedPathParams` to encapsulate multiple
   properties that define a blinded path.
2. These properties include the number of paths, the compactness of the path,
   and the number of hops.
3. This struct provides a systematic way for users to specify these properties
   before creating a blinded path, offering more flexibility and control.
4. In this version, the struct supports two properties:
   - The number of paths to generate.
   - Whether the path should be compact or not.
5. The ability to specify the number of hops will be introduced in a future update.
  • Loading branch information
shaavan committed Aug 19, 2024
1 parent 43dcf2f commit 2356ce0
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lightning/src/onion_message/messenger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,22 @@ pub struct PendingOnionMessage<T: OnionMessageContents> {
pub reply_path: Option<BlindedMessagePath>,
}

/// A placeholder value used for paths within the codebase.
///
/// PATHS_PLACEHOLDER` is temporarily used as a default value in situations
/// where a path index is required but has not yet been assigned or initialized.
pub const PATHS_PLACEHOLDER: usize = 0;

/// Represents the types of [`BlindedPath`] that can be created.
///
/// This struct allows to specify the properties of a Blinded Path before creating it.
pub struct BlindedPathParams {
/// Number of [`BlindedPath`]s to be created.
pub paths: usize,
/// Whether the created [`BlindedPath`]s are full-length or compact.
pub is_compact: bool,
}

#[cfg(c_bindings)]
/// An [`OnionMessage`] for [`OnionMessenger`] to send.
///
Expand Down

0 comments on commit 2356ce0

Please sign in to comment.