@@ -13,10 +13,12 @@ use bitcoin::secp256k1::PublicKey;
13
13
use bitcoin:: hashes:: Hash ;
14
14
use bitcoin:: hashes:: sha256:: Hash as Sha256 ;
15
15
16
+ use crate :: offers:: invoice:: BlindedPayInfo ;
16
17
use crate :: ln:: PaymentHash ;
17
18
use crate :: ln:: channelmanager:: { ChannelDetails , PaymentId } ;
18
19
use crate :: ln:: features:: { ChannelFeatures , InvoiceFeatures , NodeFeatures } ;
19
20
use crate :: ln:: msgs:: { DecodeError , ErrorAction , LightningError , MAX_VALUE_MSAT } ;
21
+ use crate :: onion_message:: BlindedPath ;
20
22
use crate :: routing:: gossip:: { DirectedChannelInfo , EffectiveCapacity , ReadOnlyNetworkGraph , NetworkGraph , NodeId , RoutingFees } ;
21
23
use crate :: routing:: scoring:: { ChannelUsage , LockableScore , Score } ;
22
24
use crate :: util:: ser:: { Writeable , Readable , ReadableArgs , Writer } ;
@@ -543,6 +545,24 @@ impl PaymentParameters {
543
545
Self { route_hints, ..self }
544
546
}
545
547
548
+ /// Includes hints for routing to a payee who is being paid to via `BlindedPath`s for privacy.
549
+ pub fn with_blinded_route_hints ( self , blinded_paths : Vec < ( BlindedPath , BlindedPayInfo ) > ) -> Self {
550
+ let route_hints = blinded_paths. into_iter ( ) . map ( |( path, payinfo) | {
551
+ RouteHint ( vec ! [ RouteHintHop {
552
+ src_node_id: path. introduction_node_id,
553
+ short_channel_id: 0 , // TODO is this too weird?
554
+ fees: RoutingFees {
555
+ base_msat: payinfo. fee_base_msat,
556
+ proportional_millionths: payinfo. fee_proportional_millionths,
557
+ } ,
558
+ cltv_expiry_delta: payinfo. cltv_expiry_delta,
559
+ htlc_minimum_msat: Some ( payinfo. htlc_minimum_msat) ,
560
+ htlc_maximum_msat: Some ( payinfo. htlc_maximum_msat) ,
561
+ } ] )
562
+ } ) . collect ( ) ;
563
+ Self { route_hints, ..self }
564
+ }
565
+
546
566
/// Includes a payment expiration in seconds relative to the UNIX epoch.
547
567
///
548
568
/// (C-not exported) since bindings don't support move semantics
@@ -600,11 +620,17 @@ impl Readable for RouteHint {
600
620
/// A channel descriptor for a hop along a payment path.
601
621
#[ derive( Clone , Debug , Hash , Eq , PartialEq ) ]
602
622
pub struct RouteHintHop {
603
- /// The node_id of the non-target end of the route
623
+ /// The node_id of the non-target end of the route. May be the introduction node id of a
624
+ /// [`BlindedPath`].
625
+ ///
626
+ /// [`BlindedPath`]: crate::onion_message::BlindedPath
604
627
pub src_node_id : PublicKey ,
605
- /// The short_channel_id of this channel
628
+ /// The short_channel_id of this channel. May be 0 if this route hint corresponds to a
629
+ /// [`BlindedPath`].
630
+ ///
631
+ /// [`BlindedPath`]: crate::onion_message::BlindedPath
606
632
pub short_channel_id : u64 ,
607
- /// The fees which must be paid to use this channel
633
+ /// The fees which must be paid to use this channel or blinded path.
608
634
pub fees : RoutingFees ,
609
635
/// The difference in CLTV values between this node and the next node.
610
636
pub cltv_expiry_delta : u16 ,
0 commit comments