@@ -1002,6 +1002,7 @@ pub enum CandidateRouteHop<'a> {
1002
1002
/// `find_route` method.
1003
1003
details : & ' a ChannelDetails ,
1004
1004
/// The node id of the payer.
1005
+ ///
1005
1006
/// Can be accessed via `source` method.
1006
1007
node_id : NodeId
1007
1008
} ,
@@ -1011,9 +1012,9 @@ pub enum CandidateRouteHop<'a> {
1011
1012
info : DirectedChannelInfo < ' a > ,
1012
1013
/// The short_channel_id of the channel.
1013
1014
short_channel_id : u64 ,
1014
- /// The node id of the current hop in route.
1015
+ /// The node id leading to the current hop in route.
1015
1016
source_node_id : NodeId ,
1016
- /// The node id of next hop in route.
1017
+ /// The node id of current hop in route.
1017
1018
target_node_id : NodeId ,
1018
1019
} ,
1019
1020
/// A hop to the payee found in the BOLT 11 payment invoice, though not necessarily a direct
@@ -1022,8 +1023,8 @@ pub enum CandidateRouteHop<'a> {
1022
1023
/// Hint provides information about a private hop, needed while routing through a private
1023
1024
/// channel.
1024
1025
hint : & ' a RouteHintHop ,
1025
- /// The node id of the next hop in route.
1026
- target_node_id : NodeId
1026
+ /// The node id of current hop in route.
1027
+ target_node_id : NodeId ,
1027
1028
} ,
1028
1029
/// The payee's identity is concealed behind blinded paths provided in a BOLT 12 invoice.
1029
1030
Blinded {
@@ -1038,6 +1039,10 @@ pub enum CandidateRouteHop<'a> {
1038
1039
/// Provided to uniquely identify a hop as we are
1039
1040
/// route building.
1040
1041
hint_idx : usize ,
1042
+ /// The node id of current hop in route.
1043
+ ///
1044
+ /// This will always equal to `maybe_dummy_payee_node_id` in `find_route` method.
1045
+ target_node_id : NodeId ,
1041
1046
} ,
1042
1047
/// Similar to [`Self::Blinded`], but the path here has 1 blinded hop. `BlindedPayInfo` provided
1043
1048
/// for 1-hop blinded paths is ignored because it is meant to apply to the hops *between* the
@@ -1053,6 +1058,10 @@ pub enum CandidateRouteHop<'a> {
1053
1058
/// Provided to uniquely identify a hop as we are
1054
1059
/// route building.
1055
1060
hint_idx : usize ,
1061
+ /// The node id of current hop in route.
1062
+ ///
1063
+ /// This will always equal to `maybe_dummy_payee_node_id` in `find_route` method.
1064
+ target_node_id : NodeId ,
1056
1065
} ,
1057
1066
}
1058
1067
@@ -1152,6 +1161,11 @@ impl<'a> CandidateRouteHop<'a> {
1152
1161
}
1153
1162
}
1154
1163
/// Returns the source node id of this hop.
1164
+ ///
1165
+ /// Source node id refers to the hop that is previous
1166
+ /// to the current examined hop in route finding.
1167
+ ///
1168
+ /// For `FirstHop` we return payer's node id.
1155
1169
pub fn source ( & self ) -> NodeId {
1156
1170
match self {
1157
1171
CandidateRouteHop :: FirstHop { node_id, .. } => * node_id,
@@ -1162,13 +1176,17 @@ impl<'a> CandidateRouteHop<'a> {
1162
1176
}
1163
1177
}
1164
1178
/// Returns the target node id of this hop, if known.
1165
- pub fn target ( & self ) -> Option < NodeId > {
1179
+ ///
1180
+ /// Target node id refers to the current examined hop in route finding.
1181
+ ///
1182
+ /// For `Blinded` and `OneHopBlinded` we return `maybe_dummy_payee_node_id` because we don't know the target.
1183
+ pub fn target ( & self ) -> NodeId {
1166
1184
match self {
1167
- CandidateRouteHop :: FirstHop { details, .. } => Some ( details. counterparty . node_id . into ( ) ) ,
1168
- CandidateRouteHop :: PublicHop { info , .. } => Some ( info . channel . node_two . into ( ) ) ,
1169
- CandidateRouteHop :: PrivateHop { target_node_id, .. } => Some ( * target_node_id) ,
1170
- CandidateRouteHop :: Blinded { hint , .. } => Some ( hint . 1 . blinding_point . into ( ) ) ,
1171
- CandidateRouteHop :: OneHopBlinded { hint , .. } => Some ( hint . 1 . blinding_point . into ( ) )
1185
+ CandidateRouteHop :: FirstHop { details, .. } => details. counterparty . node_id . into ( ) ,
1186
+ CandidateRouteHop :: PublicHop { target_node_id , .. } => * target_node_id ,
1187
+ CandidateRouteHop :: PrivateHop { target_node_id, .. } => * target_node_id,
1188
+ CandidateRouteHop :: Blinded { target_node_id , .. } => * target_node_id ,
1189
+ CandidateRouteHop :: OneHopBlinded { target_node_id , .. } => * target_node_id ,
1172
1190
}
1173
1191
}
1174
1192
}
@@ -2170,8 +2188,8 @@ where L::Target: Logger {
2170
2188
network_nodes. get ( & intro_node_id) . is_some ( ) ;
2171
2189
if !have_intro_node_in_graph || our_node_id == intro_node_id { continue }
2172
2190
let candidate = if hint. 1 . blinded_hops . len ( ) == 1 {
2173
- CandidateRouteHop :: OneHopBlinded { hint, hint_idx }
2174
- } else { CandidateRouteHop :: Blinded { hint, hint_idx } } ;
2191
+ CandidateRouteHop :: OneHopBlinded { hint, hint_idx, target_node_id : maybe_dummy_payee_node_id }
2192
+ } else { CandidateRouteHop :: Blinded { hint, hint_idx, target_node_id : maybe_dummy_payee_node_id } } ;
2175
2193
let mut path_contribution_msat = path_value_msat;
2176
2194
if let Some ( hop_used_msat) = add_entry ! ( candidate, intro_node_id, maybe_dummy_payee_node_id,
2177
2195
0 , path_contribution_msat, 0 , 0_u64 , 0 , 0 )
0 commit comments