Skip to content

Commit e72a838

Browse files
Ensure payment_params present when checking is_retryable_now
1 parent d025646 commit e72a838

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lightning/src/ln/outbound_payment.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ impl PendingOutboundPayment {
7979
}
8080
fn is_auto_retryable_now(&self) -> bool {
8181
match self {
82-
PendingOutboundPayment::Retryable { retry_strategy: Some(strategy), attempts, .. } => {
82+
PendingOutboundPayment::Retryable {
83+
retry_strategy: Some(strategy), attempts, payment_params: Some(_), ..
84+
} => {
8385
strategy.is_retryable_now(&attempts)
8486
},
8587
_ => false,
@@ -516,11 +518,12 @@ impl OutboundPayments {
516518
let mut retry_id_route_params = None;
517519
for (pmt_id, pmt) in outbounds.iter_mut() {
518520
if pmt.is_auto_retryable_now() {
519-
if let PendingOutboundPayment::Retryable { pending_amt_msat, total_msat, payment_params: Some(params), .. } = pmt {
521+
if let PendingOutboundPayment::Retryable { pending_amt_msat, total_msat, payment_params, .. } = pmt {
522+
let params = if let Some(p) = payment_params { p.clone() } else { debug_assert!(false); continue };
520523
if pending_amt_msat < total_msat {
521524
retry_id_route_params = Some((*pmt_id, RouteParameters {
522525
final_value_msat: *total_msat - *pending_amt_msat,
523-
payment_params: params.clone(),
526+
payment_params: params,
524527
}));
525528
break
526529
}

0 commit comments

Comments
 (0)