Skip to content

Commit 2c80391

Browse files
committed
Introduce BlindedPathType
1. Introduce a new enum that allows the user to specify the type of Blinded Path (whether Compact or Full-Length) when creating a Blinded Path. 2. This PR utilizes this new enum in two ways in the upcoming commits: - Allows explicitly providing the type of Blinded Path to be created instead of relying on the absolute expiry time for offers and refunds. - Simplifies the Blinded Path creation process by enabling a single function flow for creating both types of Blinded Path.
1 parent d49a08a commit 2c80391

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,34 @@ pub enum PendingHTLCRouting {
221221
},
222222
}
223223

224+
/// Represents the types of [`BlindedMessagePath`] that can be created.
225+
pub enum BlindedPathType {
226+
/// A compact version of [`BlindedMessagePath`].
227+
///
228+
/// Compact blinded paths use a [`ShortChannelId`] instead of a [`NodeId`] to represent forward nodes.
229+
/// This approach drastically reduces the size of each individual forward packet but requires
230+
/// knowledge of the local channel graph to find the corresponding channel for each node.
231+
///
232+
/// Compact blinded paths are especially useful when size is a constraint, such as when offers
233+
/// and refund information must be represented in QR code form.
234+
///
235+
/// [`ShortChannelId`]: crate::blinded_path::message::NextMessageHop::ShortChannelId
236+
/// [`NodeId`]: crate::blinded_path::message::NextMessageHop::NodeId
237+
Compact,
238+
239+
/// A full-length version of [`BlindedMessagePath`].
240+
///
241+
/// Unlike compact blinded paths, full-length paths use each individual forward node's [`NodeId`] for representation.
242+
/// This increases the size of each forward packet as more space is required for representation.
243+
/// However, it does not require knowledge of the local channel graph to create the path.
244+
///
245+
/// Full-length blinded paths are useful when onion messages are communicated over the wire and size constraints are not an issue,
246+
/// such as when sending a response to an onion message.
247+
///
248+
/// [`NodeId`]: crate::blinded_path::message::NextMessageHop::NodeId
249+
Full,
250+
}
251+
224252
/// Information used to forward or fail this HTLC that is being forwarded within a blinded path.
225253
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
226254
pub struct BlindedForward {

0 commit comments

Comments
 (0)