Skip to content

Commit 82a1a99

Browse files
committed
f: Remove global PATHS_PLACEHOLDER
1 parent f31a8fe commit 82a1a99

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

lightning/src/onion_message/messenger.rs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -432,12 +432,6 @@ pub enum MessageSendInstructions {
432432
},
433433
}
434434

435-
/// A placeholder value used for paths within the codebase.
436-
///
437-
/// PATHS_PLACEHOLDER` is temporarily used as a default value in situations
438-
/// where a path index is required but has not yet been assigned or initialized.
439-
pub const PATHS_PLACEHOLDER: usize = 0;
440-
441435
/// Represents the types of [`BlindedMessagePath`] that can be created.
442436
///
443437
/// This struct allows to specify the properties of a Blinded Path before creating it.
@@ -448,6 +442,27 @@ pub struct BlindedPathParams {
448442
pub is_compact: bool,
449443
}
450444

445+
impl BlindedPathParams {
446+
/// Number of paths to be calculated, used by default throughout the codebase.
447+
const DEFAULT_PATHS: usize = 3;
448+
449+
/// Create [`BlindedPathParams`] with default number of paths.
450+
pub fn new(is_compact: bool) -> Self {
451+
Self {
452+
paths: Self::DEFAULT_PATHS,
453+
is_compact,
454+
}
455+
}
456+
457+
/// Create [`BlindedPathParams`] with custom number of paths.
458+
pub fn new_with_paths(paths: usize, is_compact: bool) -> Self {
459+
Self {
460+
paths,
461+
is_compact,
462+
}
463+
}
464+
}
465+
451466
/// A trait defining behavior for routing an [`OnionMessage`].
452467
pub trait MessageRouter {
453468
/// Returns a route for sending an [`OnionMessage`] to the given [`Destination`].

0 commit comments

Comments
 (0)