@@ -504,8 +504,8 @@ pub struct PaymentParameters {
504
504
/// [`for_keysend`]: Self::for_keysend
505
505
pub features : Option < InvoiceFeatures > ,
506
506
507
- /// Hints for routing to the payee, containing channels connecting the payee to public nodes .
508
- pub route_hints : Hints ,
507
+ /// Route hints and other information used to route to the payee.
508
+ pub payee : Payee ,
509
509
510
510
/// Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
511
511
pub expiry_time : Option < u64 > ,
@@ -546,9 +546,9 @@ impl Writeable for PaymentParameters {
546
546
fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , io:: Error > {
547
547
let mut clear_hints = & vec ! [ ] ;
548
548
let mut blinded_hints = & vec ! [ ] ;
549
- match & self . route_hints {
550
- Hints :: Clear ( hints ) => clear_hints = hints ,
551
- Hints :: Blinded ( hints) => blinded_hints = hints,
549
+ match & self . payee {
550
+ Payee :: Clear { route_hints } => clear_hints = route_hints ,
551
+ Payee :: Blinded ( hints) => blinded_hints = hints,
552
552
}
553
553
write_tlv_fields ! ( writer, {
554
554
( 0 , self . payee_pubkey, required) ,
@@ -582,18 +582,18 @@ impl ReadableArgs<u32> for PaymentParameters {
582
582
} ) ;
583
583
let clear_route_hints = route_hints. unwrap_or ( vec ! [ ] ) ;
584
584
let blinded_route_hints = blinded_route_hints. unwrap_or ( vec ! [ ] ) ;
585
- let route_hints = if blinded_route_hints. len ( ) != 0 {
585
+ let payee = if blinded_route_hints. len ( ) != 0 {
586
586
if clear_route_hints. len ( ) != 0 { return Err ( DecodeError :: InvalidValue ) }
587
- Hints :: Blinded ( blinded_route_hints)
587
+ Payee :: Blinded ( blinded_route_hints)
588
588
} else {
589
- Hints :: Clear ( clear_route_hints)
589
+ Payee :: Clear { route_hints : clear_route_hints }
590
590
} ;
591
591
Ok ( Self {
592
592
payee_pubkey : _init_tlv_based_struct_field ! ( payee_pubkey, required) ,
593
593
max_total_cltv_expiry_delta : _init_tlv_based_struct_field ! ( max_total_cltv_expiry_delta, ( default_value, unused) ) ,
594
594
features,
595
595
max_path_count : _init_tlv_based_struct_field ! ( max_path_count, ( default_value, unused) ) ,
596
- route_hints ,
596
+ payee ,
597
597
max_channel_saturation_power_of_half : _init_tlv_based_struct_field ! ( max_channel_saturation_power_of_half, ( default_value, unused) ) ,
598
598
expiry_time,
599
599
previously_failed_channels : previously_failed_channels. unwrap_or ( Vec :: new ( ) ) ,
@@ -612,7 +612,7 @@ impl PaymentParameters {
612
612
Self {
613
613
payee_pubkey,
614
614
features : None ,
615
- route_hints : Hints :: Clear ( vec ! [ ] ) ,
615
+ payee : Payee :: Clear { route_hints : vec ! [ ] } ,
616
616
expiry_time : None ,
617
617
max_total_cltv_expiry_delta : DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA ,
618
618
max_path_count : DEFAULT_MAX_PATH_COUNT ,
@@ -641,7 +641,7 @@ impl PaymentParameters {
641
641
///
642
642
/// This is not exported to bindings users since bindings don't support move semantics
643
643
pub fn with_route_hints ( self , route_hints : Vec < RouteHint > ) -> Self {
644
- Self { route_hints : Hints :: Clear ( route_hints) , ..self }
644
+ Self { payee : Payee :: Clear { route_hints } , ..self }
645
645
}
646
646
647
647
/// Includes a payment expiration in seconds relative to the UNIX epoch.
@@ -673,14 +673,18 @@ impl PaymentParameters {
673
673
}
674
674
}
675
675
676
- /// Routing hints for the tail of the route.
676
+ /// Information used to route to a recipient, differing based on whether they've hidden their
677
+ /// identity with route blinding.
677
678
#[ derive( Clone , Debug , Hash , PartialEq , Eq ) ]
678
- pub enum Hints {
679
+ pub enum Payee {
679
680
/// The recipient provided blinded paths and payinfo to reach them. The blinded paths themselves
680
681
/// will be included in the final [`Route`].
681
682
Blinded ( Vec < ( BlindedPayInfo , BlindedPath ) > ) ,
682
683
/// The recipient included these route hints in their BOLT11 invoice.
683
- Clear ( Vec < RouteHint > ) ,
684
+ Clear {
685
+ /// Hints for routing to the payee, containing channels connecting the payee to public nodes.
686
+ route_hints : Vec < RouteHint > ,
687
+ } ,
684
688
}
685
689
686
690
/// A list of hops along a payment path terminating with a channel to the recipient.
@@ -1131,9 +1135,9 @@ where L::Target: Logger {
1131
1135
return Err ( LightningError { err : "Cannot send a payment of 0 msat" . to_owned ( ) , action : ErrorAction :: IgnoreError } ) ;
1132
1136
}
1133
1137
1134
- match & payment_params. route_hints {
1135
- Hints :: Clear ( hints ) => {
1136
- for route in hints . iter ( ) {
1138
+ match & payment_params. payee {
1139
+ Payee :: Clear { route_hints } => {
1140
+ for route in route_hints . iter ( ) {
1137
1141
for hop in & route. 0 {
1138
1142
if hop. src_node_id == payment_params. payee_pubkey {
1139
1143
return Err ( LightningError { err : "Route hint cannot have the payee as the source." . to_owned ( ) , action : ErrorAction :: IgnoreError } ) ;
@@ -1664,8 +1668,8 @@ where L::Target: Logger {
1664
1668
// If a caller provided us with last hops, add them to routing targets. Since this happens
1665
1669
// earlier than general path finding, they will be somewhat prioritized, although currently
1666
1670
// it matters only if the fees are exactly the same.
1667
- let route_hints = match & payment_params. route_hints {
1668
- Hints :: Clear ( hints ) => hints ,
1671
+ let route_hints = match & payment_params. payee {
1672
+ Payee :: Clear { route_hints } => route_hints ,
1669
1673
_ => return Err ( LightningError { err : "Routing to blinded paths isn't supported yet" . to_owned ( ) , action : ErrorAction :: IgnoreError } ) ,
1670
1674
} ;
1671
1675
for route in route_hints. iter ( ) . filter ( |route| !route. 0 . is_empty ( ) ) {
0 commit comments