@@ -634,8 +634,32 @@ impl PaymentParameters {
634
634
. expect ( "PaymentParameters::from_node_id should always initialize the payee as unblinded" )
635
635
}
636
636
637
- /// Includes the payee's features. Errors if the parameters were initialized with blinded payment
638
- /// paths.
637
+ /// Creates parameters for paying to a blinded payee.
638
+ pub fn blinded ( blinded_route_hints : Vec < ( BlindedPayInfo , BlindedPath ) > ) -> Self {
639
+ Self {
640
+ payee : Payee :: Blinded { route_hints : blinded_route_hints, features : None } ,
641
+ expiry_time : None ,
642
+ max_total_cltv_expiry_delta : DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA ,
643
+ max_path_count : DEFAULT_MAX_PATH_COUNT ,
644
+ max_channel_saturation_power_of_half : 2 ,
645
+ previously_failed_channels : Vec :: new ( ) ,
646
+ }
647
+ }
648
+
649
+ /// Includes the payee's features. Errors if the parameters were not initialized with
650
+ /// [`PaymentParameters::blinded`].
651
+ ///
652
+ /// This is not exported to bindings users since bindings don't support move semantics
653
+ pub fn with_bolt12_features ( self , features : Bolt12InvoiceFeatures ) -> Result < Self , ( ) > {
654
+ match self . payee {
655
+ Payee :: Clear { .. } => Err ( ( ) ) ,
656
+ Payee :: Blinded { route_hints, .. } =>
657
+ Ok ( Self { payee : Payee :: Blinded { route_hints, features : Some ( features) } , ..self } )
658
+ }
659
+ }
660
+
661
+ /// Includes the payee's features. Errors if the parameters were initialized with
662
+ /// [`PaymentParameters::blinded`].
639
663
///
640
664
/// This is not exported to bindings users since bindings don't support move semantics
641
665
pub fn with_bolt11_features ( self , features : InvoiceFeatures ) -> Result < Self , ( ) > {
@@ -651,7 +675,7 @@ impl PaymentParameters {
651
675
}
652
676
653
677
/// Includes hints for routing to the payee. Errors if the parameters were initialized with
654
- /// blinded payment paths .
678
+ /// [`PaymentParameters:: blinded`] .
655
679
///
656
680
/// This is not exported to bindings users since bindings don't support move semantics
657
681
pub fn with_route_hints ( self , route_hints : Vec < RouteHint > ) -> Result < Self , ( ) > {
0 commit comments