Skip to content

Commit 8138bec

Browse files
committed
Relax ann. checks to enable paying direct-connected BOLT12 recipients
1 parent 35c408f commit 8138bec

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

lightning/src/onion_message/messenger.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ where
355355

356356
// Ensure peers have at least three channels so that it is more difficult to infer the
357357
// recipient's node_id.
358-
const MIN_PEER_CHANNELS: usize = 3;
358+
const MIN_PEER_CHANNELS: usize = 0;
359359

360360
let network_graph = self.network_graph.deref().read_only();
361361
let is_recipient_announced =
@@ -387,12 +387,8 @@ where
387387
match paths {
388388
Ok(paths) if !paths.is_empty() => Ok(paths),
389389
_ => {
390-
if is_recipient_announced {
391-
BlindedPath::one_hop_for_message(recipient, &*self.entropy_source, secp_ctx)
392-
.map(|path| vec![path])
393-
} else {
394-
Err(())
395-
}
390+
BlindedPath::one_hop_for_message(recipient, &*self.entropy_source, secp_ctx)
391+
.map(|path| vec![path])
396392
},
397393
}
398394
}

lightning/src/routing/router.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl<G: Deref<Target = NetworkGraph<L>> + Clone, L: Deref, ES: Deref, S: Deref,
9090

9191
// Ensure peers have at least three channels so that it is more difficult to infer the
9292
// recipient's node_id.
93-
const MIN_PEER_CHANNELS: usize = 3;
93+
const MIN_PEER_CHANNELS: usize = 0;
9494

9595
let network_graph = self.network_graph.deref().read_only();
9696
let paths = first_hops.into_iter()
@@ -144,13 +144,9 @@ impl<G: Deref<Target = NetworkGraph<L>> + Clone, L: Deref, ES: Deref, S: Deref,
144144
match paths {
145145
Ok(paths) if !paths.is_empty() => Ok(paths),
146146
_ => {
147-
if network_graph.nodes().contains_key(&NodeId::from_pubkey(&recipient)) {
148-
BlindedPath::one_hop_for_payment(
149-
recipient, tlvs, MIN_FINAL_CLTV_EXPIRY_DELTA, &*self.entropy_source, secp_ctx
147+
BlindedPath::one_hop_for_payment(
148+
recipient, tlvs, MIN_FINAL_CLTV_EXPIRY_DELTA, &*self.entropy_source, secp_ctx
150149
).map(|path| vec![path])
151-
} else {
152-
Err(())
153-
}
154150
},
155151
}
156152
}

0 commit comments

Comments
 (0)