Skip to content

Commit 04c45ad

Browse files
committed
Update Default Blinded Path constructor to use Dummy Hops
Applies dummy hops by default when constructing blinded paths via `DefaultMessageRouter`, enhancing privacy by obscuring the true path length. Uses a predefined `DUMMY_HOPS_COUNT` to apply dummy hops consistently without requiring explicit user input.
1 parent c401e34 commit 04c45ad

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lightning/src/onion_message/messenger.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,9 @@ where
563563
// recipient's node_id.
564564
const MIN_PEER_CHANNELS: usize = 3;
565565

566+
// Add dummy hops to each blinded path to make it more difficult to infer the recipient's position.
567+
const DUMMY_HOPS_COUNT: u8 = 3;
568+
566569
let network_graph = network_graph.deref().read_only();
567570
let is_recipient_announced =
568571
network_graph.nodes().contains_key(&NodeId::from_pubkey(&recipient));
@@ -602,7 +605,7 @@ where
602605
Ok(paths) if !paths.is_empty() => Ok(paths),
603606
_ => {
604607
if is_recipient_announced {
605-
BlindedMessagePath::new(&[], recipient, context, &**entropy_source, secp_ctx)
608+
BlindedMessagePath::new_with_dummy_hops(&[], DUMMY_HOPS_COUNT, recipient, context, &**entropy_source, secp_ctx)
606609
.map(|path| vec![path])
607610
} else {
608611
Err(())

0 commit comments

Comments
 (0)