@@ -948,7 +948,14 @@ enum CandidateRouteHop<'a> {
948
948
Blinded {
949
949
hint : & ' a ( BlindedPayInfo , BlindedPath ) ,
950
950
hint_idx : usize ,
951
- }
951
+ } ,
952
+ /// Similar to [`Self::Blinded`], but the path here has 1 blinded hop. `BlindedPayInfo` provided
953
+ /// for 1-hop blinded paths is ignored because it is meant to apply to the hops *between* the
954
+ /// introduction node and the destination.
955
+ OneHopBlinded {
956
+ hint : & ' a ( BlindedPayInfo , BlindedPath ) ,
957
+ hint_idx : usize ,
958
+ } ,
952
959
}
953
960
954
961
impl < ' a > CandidateRouteHop < ' a > {
@@ -958,6 +965,7 @@ impl<'a> CandidateRouteHop<'a> {
958
965
CandidateRouteHop :: PublicHop { short_channel_id, .. } => Some ( * short_channel_id) ,
959
966
CandidateRouteHop :: PrivateHop { hint } => Some ( hint. short_channel_id ) ,
960
967
CandidateRouteHop :: Blinded { .. } => None ,
968
+ CandidateRouteHop :: OneHopBlinded { .. } => None ,
961
969
}
962
970
}
963
971
@@ -968,6 +976,7 @@ impl<'a> CandidateRouteHop<'a> {
968
976
CandidateRouteHop :: PublicHop { info, .. } => info. channel ( ) . features . clone ( ) ,
969
977
CandidateRouteHop :: PrivateHop { .. } => ChannelFeatures :: empty ( ) ,
970
978
CandidateRouteHop :: Blinded { .. } => ChannelFeatures :: empty ( ) ,
979
+ CandidateRouteHop :: OneHopBlinded { .. } => ChannelFeatures :: empty ( ) ,
971
980
}
972
981
}
973
982
@@ -976,8 +985,8 @@ impl<'a> CandidateRouteHop<'a> {
976
985
CandidateRouteHop :: FirstHop { .. } => 0 ,
977
986
CandidateRouteHop :: PublicHop { info, .. } => info. direction ( ) . cltv_expiry_delta as u32 ,
978
987
CandidateRouteHop :: PrivateHop { hint } => hint. cltv_expiry_delta as u32 ,
979
- CandidateRouteHop :: Blinded { hint, .. } =>
980
- if hint . 1 . blinded_hops . len ( ) == 1 { 0 } else { hint . 0 . cltv_expiry_delta as u32 }
988
+ CandidateRouteHop :: Blinded { hint, .. } => hint . 0 . cltv_expiry_delta as u32 ,
989
+ CandidateRouteHop :: OneHopBlinded { .. } => 0 ,
981
990
}
982
991
}
983
992
@@ -986,8 +995,8 @@ impl<'a> CandidateRouteHop<'a> {
986
995
CandidateRouteHop :: FirstHop { details } => details. next_outbound_htlc_minimum_msat ,
987
996
CandidateRouteHop :: PublicHop { info, .. } => info. direction ( ) . htlc_minimum_msat ,
988
997
CandidateRouteHop :: PrivateHop { hint } => hint. htlc_minimum_msat . unwrap_or ( 0 ) ,
989
- CandidateRouteHop :: Blinded { hint, .. } =>
990
- if hint . 1 . blinded_hops . len ( ) == 1 { 0 } else { hint . 0 . htlc_minimum_msat }
998
+ CandidateRouteHop :: Blinded { hint, .. } => hint . 0 . htlc_minimum_msat ,
999
+ CandidateRouteHop :: OneHopBlinded { .. } => 0 ,
991
1000
}
992
1001
}
993
1002
@@ -999,15 +1008,13 @@ impl<'a> CandidateRouteHop<'a> {
999
1008
CandidateRouteHop :: PublicHop { info, .. } => info. direction ( ) . fees ,
1000
1009
CandidateRouteHop :: PrivateHop { hint } => hint. fees ,
1001
1010
CandidateRouteHop :: Blinded { hint, .. } => {
1002
- if hint. 1 . blinded_hops . len ( ) == 1 {
1003
- RoutingFees { base_msat : 0 , proportional_millionths : 0 }
1004
- } else {
1005
- RoutingFees {
1006
- base_msat : hint. 0 . fee_base_msat ,
1007
- proportional_millionths : hint. 0 . fee_proportional_millionths
1008
- }
1011
+ RoutingFees {
1012
+ base_msat : hint. 0 . fee_base_msat ,
1013
+ proportional_millionths : hint. 0 . fee_proportional_millionths
1009
1014
}
1010
- }
1015
+ } ,
1016
+ CandidateRouteHop :: OneHopBlinded { .. } =>
1017
+ RoutingFees { base_msat : 0 , proportional_millionths : 0 } ,
1011
1018
}
1012
1019
}
1013
1020
@@ -1022,14 +1029,15 @@ impl<'a> CandidateRouteHop<'a> {
1022
1029
CandidateRouteHop :: PrivateHop { hint : RouteHintHop { htlc_maximum_msat : None , .. } } =>
1023
1030
EffectiveCapacity :: Infinite ,
1024
1031
CandidateRouteHop :: Blinded { hint, .. } =>
1025
- if hint . 1 . blinded_hops . len ( ) == 1 { EffectiveCapacity :: Infinite }
1026
- else { EffectiveCapacity :: HintMaxHTLC { amount_msat : hint . 0 . htlc_maximum_msat } }
1032
+ EffectiveCapacity :: HintMaxHTLC { amount_msat : hint . 0 . htlc_maximum_msat } ,
1033
+ CandidateRouteHop :: OneHopBlinded { .. } => EffectiveCapacity :: Infinite ,
1027
1034
}
1028
1035
}
1029
1036
1030
1037
fn id ( & self , channel_direction : bool /* src_node_id < target_node_id */ ) -> CandidateHopId {
1031
1038
match self {
1032
1039
CandidateRouteHop :: Blinded { hint_idx, .. } => CandidateHopId :: Blinded ( * hint_idx) ,
1040
+ CandidateRouteHop :: OneHopBlinded { hint_idx, .. } => CandidateHopId :: Blinded ( * hint_idx) ,
1033
1041
_ => CandidateHopId :: Clear ( ( self . short_channel_id ( ) . unwrap ( ) , channel_direction) ) ,
1034
1042
}
1035
1043
}
@@ -1286,7 +1294,7 @@ struct LoggedCandidateHop<'a>(&'a CandidateRouteHop<'a>);
1286
1294
impl < ' a > fmt:: Display for LoggedCandidateHop < ' a > {
1287
1295
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
1288
1296
match self . 0 {
1289
- CandidateRouteHop :: Blinded { hint, .. } => {
1297
+ CandidateRouteHop :: Blinded { hint, .. } | CandidateRouteHop :: OneHopBlinded { hint , .. } => {
1290
1298
"blinded route hint with introduction node id " . fmt ( f) ?;
1291
1299
hint. 1 . introduction_node_id . fmt ( f) ?;
1292
1300
" and blinding point " . fmt ( f) ?;
0 commit comments