Skip to content

Commit 0e5e8a6

Browse files
committed
eight commit
1 parent a8781ca commit 0e5e8a6

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

lightning/src/routing/router.rs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,15 +1267,30 @@ where L::Target: Logger {
12671267
// around again with a higher amount.
12681268
if !contributes_sufficient_value || exceeds_max_path_length ||
12691269
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+
};
12721277
for channel_details in target {
12731278
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+
12761290
}
12771291
}
12781292
}
1293+
// Path isn't useful, ignore it and move on.
12791294
} else if may_overpay_to_meet_path_minimum_msat {
12801295
hit_minimum_limit = true;
12811296
} else if over_path_minimum_msat {

0 commit comments

Comments
 (0)