Skip to content

Commit 5bc12d4

Browse files
committed
Fix: Ignore SCIDs when creating full-length blinded paths
Previously, the `compact_paths` flag was only used to determine whether to use a compact introduction node when creating compact blinded paths. With the upcoming change to accept `MessageForwardNode` in `create_blinded_paths`, there's a risk of SCIDs being passed (and used) even when the user intends to create a full-length blinded path. This patch updates the logic in `create_blinded_paths_from_iter` to ignore SCIDs unless `compact_paths` is explicitly true—preserving correct behavior for full-length blinded paths. And while we are at it, we also update a minor article fix for the DefaultMessageRouter, and Router documentation.
1 parent e8f5f90 commit 5bc12d4

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lightning/src/onion_message/messenger.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ pub trait MessageRouter {
541541
/// # Privacy
542542
///
543543
/// Creating [`BlindedMessagePath`]s may affect privacy since, if a suitable path cannot be found,
544-
/// it will create a one-hop path using the recipient as the introduction node if it is a announced
544+
/// it will create a one-hop path using the recipient as the introduction node if it is an announced
545545
/// node. Otherwise, there is no way to find a path to the introduction node in order to send a
546546
/// message, and thus an `Err` is returned.
547547
pub struct DefaultMessageRouter<G: Deref<Target = NetworkGraph<L>>, L: Deref, ES: Deref>
@@ -584,6 +584,10 @@ where
584584

585585
let has_one_peer = peers.len() == 1;
586586
let mut peer_info = peers
587+
.map(|peer| MessageForwardNode {
588+
short_channel_id: if compact_paths { peer.short_channel_id } else { None },
589+
..peer
590+
})
587591
// Limit to peers with announced channels unless the recipient is unannounced.
588592
.filter_map(|peer| {
589593
network_graph

lightning/src/routing/router.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub use lightning_types::routing::{RouteHint, RouteHintHop};
5353
/// # Privacy
5454
///
5555
/// Creating [`BlindedPaymentPath`]s may affect privacy since, if a suitable path cannot be found,
56-
/// it will create a one-hop path using the recipient as the introduction node if it is a announced
56+
/// it will create a one-hop path using the recipient as the introduction node if it is an announced
5757
/// node. Otherwise, there is no way to find a path to the introduction node in order to send a
5858
/// payment, and thus an `Err` is returned.
5959
pub struct DefaultRouter<

0 commit comments

Comments
 (0)