@@ -1267,15 +1267,30 @@ where L::Target: Logger {
1267
1267
// around again with a higher amount.
1268
1268
if !contributes_sufficient_value || exceeds_max_path_length ||
1269
1269
exceeds_cltv_delta_limit || payment_failed_on_this_channel {
1270
- let our_node_id = NodeId :: from_pubkey( & our_node_pubkey) ;
1271
- let target = first_hop_targets. get( & NodeId :: from_pubkey( & our_node_pubkey) ) . unwrap( ) ;
1270
+ let empty_vec: Vec <& ChannelDetails > = Vec :: new( ) ;
1271
+ let target = match first_hop_targets. get( & NodeId :: from_pubkey( & our_node_pubkey) ) {
1272
+ Some ( value) => value,
1273
+ None => {
1274
+ & empty_vec
1275
+ }
1276
+ } ;
1272
1277
for channel_details in target {
1273
1278
if let Some ( short_channel_id_target) = channel_details. short_channel_id {
1274
- if short_channel_id == short_channel_id_target {
1275
- log_trace!( logger, "first Hop of node id {our_node_id} is excluded due to a failed requirement." ) ;
1279
+ if short_channel_id == short_channel_id_target { // short_channel_id is hop id of candidate.
1280
+ if !contributes_sufficient_value {
1281
+ log_trace!( logger, "First Hop {short_channel_id} is excluded due to insufficient balance" ) ;
1282
+ } else if exceeds_max_path_length {
1283
+ log_trace!( logger, "First Hop {short_channel_id} is excluded due to candidate hop excluded max path length" ) ;
1284
+ } else if exceeds_cltv_delta_limit {
1285
+ log_trace!( logger, "First Hop {short_channel_id} is excluded beacause it exceed the maximum total cltv expiry limit" ) ;
1286
+ } else if payment_failed_on_this_channel {
1287
+ log_trace!( logger, "First Hop {short_channel_id} is excluded beacause it was failed previously" ) ;
1288
+ }
1289
+
1276
1290
}
1277
1291
}
1278
1292
}
1293
+ // Path isn't useful, ignore it and move on.
1279
1294
} else if may_overpay_to_meet_path_minimum_msat {
1280
1295
hit_minimum_limit = true ;
1281
1296
} else if over_path_minimum_msat {
0 commit comments