Skip to content

Commit 8d13f41

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 cd298aa commit 8d13f41

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
@@ -535,7 +535,7 @@ pub trait MessageRouter {
535535
/// # Privacy
536536
///
537537
/// Creating [`BlindedMessagePath`]s may affect privacy since, if a suitable path cannot be found,
538-
/// it will create a one-hop path using the recipient as the introduction node if it is a announced
538+
/// it will create a one-hop path using the recipient as the introduction node if it is an announced
539539
/// node. Otherwise, there is no way to find a path to the introduction node in order to send a
540540
/// message, and thus an `Err` is returned.
541541
pub struct DefaultMessageRouter<G: Deref<Target = NetworkGraph<L>>, L: Deref, ES: Deref>
@@ -577,6 +577,10 @@ where
577577

578578
let has_one_peer = peers.len() == 1;
579579
let mut peer_info = peers
580+
.map(|peer| MessageForwardNode {
581+
short_channel_id: if compact_paths { peer.short_channel_id } else { None },
582+
..peer
583+
})
580584
// Limit to peers with announced channels unless the recipient is unannounced.
581585
.filter_map(|peer| {
582586
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)