Skip to content

Commit dc426a4

Browse files
Fix outbound_payment for new Path::blinded_tail
1 parent 46aea41 commit dc426a4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lightning/src/ln/outbound_payment.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ impl OutboundPayments {
719719
};
720720
for path in route.paths.iter() {
721721
if path.hops.len() == 0 {
722-
log_error!(logger, "length-0 path in route");
722+
log_error!(logger, "Unusable path in route (path.hops.len() must be at least 1");
723723
self.abandon_payment(payment_id, PaymentFailureReason::UnexpectedError, pending_events);
724724
return
725725
}
@@ -895,7 +895,7 @@ impl OutboundPayments {
895895

896896
let payment_hash = probing_cookie_from_id(&payment_id, probing_cookie_secret);
897897

898-
if path.hops.len() < 2 {
898+
if path.hops.len() < 2 && path.blinded_tail.is_none() {
899899
return Err(PaymentSendFailure::ParameterError(APIError::APIMisuseError {
900900
err: "No need probing a path with less than two hops".to_string()
901901
}))
@@ -1004,8 +1004,10 @@ impl OutboundPayments {
10041004
path_errs.push(Err(APIError::InvalidRoute{err: "Sending to blinded paths isn't supported yet".to_owned()}));
10051005
continue 'path_check;
10061006
}
1007+
let dest_hop_idx = if path.blinded_tail.is_some() && path.blinded_tail.as_ref().unwrap().hops.len() > 1 {
1008+
usize::max_value() } else { path.hops.len() - 1 };
10071009
for (idx, hop) in path.hops.iter().enumerate() {
1008-
if idx != path.hops.len() - 1 && hop.pubkey == our_node_id {
1010+
if idx != dest_hop_idx && hop.pubkey == our_node_id {
10091011
path_errs.push(Err(APIError::InvalidRoute{err: "Path went through us but wasn't a simple rebalance loop to us".to_owned()}));
10101012
continue 'path_check;
10111013
}

0 commit comments

Comments
 (0)