Skip to content

Commit a9992fd

Browse files
DecodedOnionFailure::payment_retryable -> ::recipient_rejected
recipient_rejected is more specific than payment_retryable and is more in line with our other internal verbiage like FailureReason::RecipientRejected.
1 parent f0d560d commit a9992fd

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lightning/src/ln/onion_utils.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ pub(super) fn build_first_hop_failure_packet(shared_secret: &[u8], failure_type:
426426
pub(crate) struct DecodedOnionFailure {
427427
pub(crate) network_update: Option<NetworkUpdate>,
428428
pub(crate) short_channel_id: Option<u64>,
429-
pub(crate) payment_retryable: bool,
429+
pub(crate) recipient_rejected: bool,
430430
#[cfg(test)]
431431
pub(crate) onion_error_code: Option<u16>,
432432
#[cfg(test)]
@@ -682,7 +682,7 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(
682682
}).expect("Route that we sent via spontaneously grew invalid keys in the middle of it?");
683683
if let Some(FailureLearnings { network_update, short_channel_id, recipient_rejected }) = res {
684684
DecodedOnionFailure {
685-
network_update, short_channel_id, payment_retryable: !recipient_rejected,
685+
network_update, short_channel_id, recipient_rejected,
686686
#[cfg(test)]
687687
onion_error_code: error_code_ret,
688688
#[cfg(test)]
@@ -692,7 +692,7 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(
692692
// only not set either packet unparseable or hmac does not match with any
693693
// payment not retryable only when garbage is from the final node
694694
DecodedOnionFailure {
695-
network_update: None, short_channel_id: None, payment_retryable: !is_from_final_node,
695+
network_update: None, short_channel_id: None, recipient_rejected: is_from_final_node,
696696
#[cfg(test)]
697697
onion_error_code: None,
698698
#[cfg(test)]
@@ -836,7 +836,7 @@ impl HTLCFailReason {
836836
if let &HTLCSource::OutboundRoute { ref path, .. } = htlc_source {
837837
DecodedOnionFailure {
838838
network_update: None,
839-
payment_retryable: true,
839+
recipient_rejected: false,
840840
short_channel_id: Some(path.hops[0].short_channel_id),
841841
#[cfg(test)]
842842
onion_error_code: Some(*failure_code),

lightning/src/ln/outbound_payment.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,10 +1484,10 @@ impl OutboundPayments {
14841484
) -> bool where L::Target: Logger {
14851485
#[cfg(test)]
14861486
let DecodedOnionFailure {
1487-
network_update, short_channel_id, payment_retryable, onion_error_code, onion_error_data
1487+
network_update, short_channel_id, recipient_rejected, onion_error_code, onion_error_data
14881488
} = onion_error.decode_onion_failure(secp_ctx, logger, &source);
14891489
#[cfg(not(test))]
1490-
let DecodedOnionFailure { network_update, short_channel_id, payment_retryable } =
1490+
let DecodedOnionFailure { network_update, short_channel_id, recipient_rejected } =
14911491
onion_error.decode_onion_failure(secp_ctx, logger, &source);
14921492

14931493
let payment_is_probe = payment_is_probe(payment_hash, &payment_id, probing_cookie_secret);
@@ -1528,8 +1528,8 @@ impl OutboundPayments {
15281528
payment.get_mut().insert_previously_failed_scid(scid);
15291529
}
15301530

1531-
if payment_is_probe || !is_retryable_now || !payment_retryable {
1532-
let reason = if !payment_retryable {
1531+
if payment_is_probe || !is_retryable_now || recipient_rejected {
1532+
let reason = if recipient_rejected {
15331533
PaymentFailureReason::RecipientRejected
15341534
} else {
15351535
PaymentFailureReason::RetriesExhausted
@@ -1559,7 +1559,7 @@ impl OutboundPayments {
15591559

15601560
let path_failure = {
15611561
if payment_is_probe {
1562-
if !payment_retryable {
1562+
if recipient_rejected {
15631563
events::Event::ProbeSuccessful {
15641564
payment_id: *payment_id,
15651565
payment_hash: payment_hash.clone(),
@@ -1583,7 +1583,7 @@ impl OutboundPayments {
15831583
events::Event::PaymentPathFailed {
15841584
payment_id: Some(*payment_id),
15851585
payment_hash: payment_hash.clone(),
1586-
payment_failed_permanently: !payment_retryable,
1586+
payment_failed_permanently: recipient_rejected,
15871587
failure: events::PathFailure::OnPath { network_update },
15881588
path: path.clone(),
15891589
short_channel_id,

0 commit comments

Comments
 (0)