@@ -13,8 +13,7 @@ use bitcoin::secp256k1::{self, PublicKey, Secp256k1};
1313use lightning_invoice:: Bolt11Invoice ;
1414
1515use crate :: blinded_path:: payment:: {
16- BlindedPaymentPath , ForwardTlvs , PaymentConstraints , PaymentForwardNode , PaymentRelay ,
17- ReceiveTlvs ,
16+ BlindedPaymentPath , ForwardTlvs , PaymentConstraints , PaymentForwardNode , PaymentRelay , ReceiveTlvs
1817} ;
1918use crate :: blinded_path:: { BlindedHop , Direction , IntroductionNode } ;
2019use crate :: crypto:: chacha20:: ChaCha20 ;
@@ -74,6 +73,9 @@ pub struct DefaultRouter<
7473 score_params : SP ,
7574}
7675
76+ /// The number of dummy hops included in [`BlindedPaymentPath`]s created by [`DefaultRouter`].
77+ pub const DEFAULT_PAYMENT_DUMMY_HOPS : usize = 3 ;
78+
7779impl <
7880 G : Deref < Target = NetworkGraph < L > > ,
7981 L : Deref ,
@@ -198,9 +200,9 @@ where
198200 } )
199201 } )
200202 . map ( |forward_node| {
201- BlindedPaymentPath :: new (
202- & [ forward_node] , recipient, local_node_receive_key, tlvs. clone ( ) , u64:: MAX , MIN_FINAL_CLTV_EXPIRY_DELTA ,
203- & * self . entropy_source , secp_ctx
203+ BlindedPaymentPath :: new_with_dummy_hops (
204+ & [ forward_node] , recipient, DEFAULT_PAYMENT_DUMMY_HOPS , local_node_receive_key, tlvs. clone ( ) , u64:: MAX ,
205+ MIN_FINAL_CLTV_EXPIRY_DELTA , & * self . entropy_source , secp_ctx
204206 )
205207 } )
206208 . take ( MAX_PAYMENT_PATHS )
@@ -210,9 +212,9 @@ where
210212 Ok ( paths) if !paths. is_empty ( ) => Ok ( paths) ,
211213 _ => {
212214 if network_graph. nodes ( ) . contains_key ( & NodeId :: from_pubkey ( & recipient) ) {
213- BlindedPaymentPath :: new (
214- & [ ] , recipient, local_node_receive_key, tlvs, u64:: MAX , MIN_FINAL_CLTV_EXPIRY_DELTA , & * self . entropy_source ,
215- secp_ctx
215+ BlindedPaymentPath :: new_with_dummy_hops (
216+ & [ ] , recipient, DEFAULT_PAYMENT_DUMMY_HOPS , local_node_receive_key, tlvs, u64:: MAX ,
217+ MIN_FINAL_CLTV_EXPIRY_DELTA , & * self . entropy_source , secp_ctx
216218 ) . map ( |path| vec ! [ path] )
217219 } else {
218220 Err ( ( ) )
0 commit comments