Skip to content

Commit 0e540c8

Browse files
committed
f - log failed path APIErrors
1 parent 4ba183d commit 0e540c8

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lightning/src/ln/outbound_payment.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -796,11 +796,11 @@ impl OutboundPayments {
796796
{
797797
match err {
798798
PaymentSendFailure::AllFailedResendSafe(errs) => {
799-
Self::push_path_failed_evs_and_scids(payment_id, payment_hash, &mut route_params, route.paths, errs.into_iter().map(|e| Err(e)), pending_events);
799+
Self::push_path_failed_evs_and_scids(payment_id, payment_hash, &mut route_params, route.paths, errs.into_iter().map(|e| Err(e)), logger, pending_events);
800800
self.retry_payment_internal(payment_hash, payment_id, route_params, router, first_hops, inflight_htlcs, entropy_source, node_signer, best_block_height, logger, pending_events, send_payment_along_path);
801801
},
802802
PaymentSendFailure::PartialFailure { failed_paths_retry: Some(mut retry), results, .. } => {
803-
Self::push_path_failed_evs_and_scids(payment_id, payment_hash, &mut retry, route.paths, results.into_iter(), pending_events);
803+
Self::push_path_failed_evs_and_scids(payment_id, payment_hash, &mut retry, route.paths, results.into_iter(), logger, pending_events);
804804
// Some paths were sent, even if we failed to send the full MPP value our recipient may
805805
// misbehave and claim the funds, at which point we have to consider the payment sent, so
806806
// return `Ok()` here, ignoring any retry errors.
@@ -813,7 +813,7 @@ impl OutboundPayments {
813813
},
814814
PaymentSendFailure::PathParameterError(results) => {
815815
log_error!(logger, "Failed to send to route due to parameter error in a single path. Your router is buggy");
816-
Self::push_path_failed_evs_and_scids(payment_id, payment_hash, &mut route_params, route.paths, results.into_iter(), pending_events);
816+
Self::push_path_failed_evs_and_scids(payment_id, payment_hash, &mut route_params, route.paths, results.into_iter(), logger, pending_events);
817817
self.abandon_payment(payment_id, PaymentFailureReason::UnexpectedError, pending_events);
818818
},
819819
PaymentSendFailure::ParameterError(e) => {
@@ -824,15 +824,16 @@ impl OutboundPayments {
824824
}
825825
}
826826

827-
fn push_path_failed_evs_and_scids<I: ExactSizeIterator + Iterator<Item = Result<(), APIError>>>(
827+
fn push_path_failed_evs_and_scids<I: ExactSizeIterator + Iterator<Item = Result<(), APIError>>, L: Deref>(
828828
payment_id: PaymentId, payment_hash: PaymentHash, route_params: &mut RouteParameters,
829-
paths: Vec<Vec<RouteHop>>, path_results: I, pending_events: &Mutex<Vec<events::Event>>
830-
) {
829+
paths: Vec<Vec<RouteHop>>, path_results: I, logger: &L, pending_events: &Mutex<Vec<events::Event>>
830+
) where L::Target: Logger {
831831
let mut events = pending_events.lock().unwrap();
832832
debug_assert_eq!(paths.len(), path_results.len());
833833
for (path, path_res) in paths.into_iter().zip(path_results) {
834834
if let Err(e) = path_res {
835835
if let APIError::MonitorUpdateInProgress = e { continue }
836+
log_error!(logger, "Failed to send along path due to error: {:?}", e);
836837
let mut failed_scid = None;
837838
if let APIError::ChannelUnavailable { .. } = e {
838839
let scid = path[0].short_channel_id;

0 commit comments

Comments
 (0)