Skip to content

Commit 9f35b5c

Browse files
Revert "Expose onion_error_code in DecodedOnionFailure in cfg(not(test))."
This reverts commit e25a892.
1 parent e25a892 commit 9f35b5c

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lightning/src/ln/onion_utils.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ pub(crate) struct DecodedOnionFailure {
429429
pub(crate) network_update: Option<NetworkUpdate>,
430430
pub(crate) short_channel_id: Option<u64>,
431431
pub(crate) payment_failed_permanently: bool,
432+
#[cfg(test)]
432433
pub(crate) onion_error_code: Option<u16>,
433434
#[cfg(test)]
434435
pub(crate) onion_error_data: Option<Vec<u8>>,
@@ -720,6 +721,7 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(
720721
}) = res {
721722
DecodedOnionFailure {
722723
network_update, short_channel_id, payment_failed_permanently,
724+
#[cfg(test)]
723725
onion_error_code: error_code_ret,
724726
#[cfg(test)]
725727
onion_error_data: error_packet_ret
@@ -729,6 +731,7 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(
729731
// payment not retryable only when garbage is from the final node
730732
DecodedOnionFailure {
731733
network_update: None, short_channel_id: None, payment_failed_permanently: is_from_final_node,
734+
#[cfg(test)]
732735
onion_error_code: None,
733736
#[cfg(test)]
734737
onion_error_data: None
@@ -875,6 +878,7 @@ impl HTLCFailReason {
875878
network_update: None,
876879
payment_failed_permanently: false,
877880
short_channel_id: Some(path.hops[0].short_channel_id),
881+
#[cfg(test)]
878882
onion_error_code: Some(*failure_code),
879883
#[cfg(test)]
880884
onion_error_data: Some(data.clone()),

lightning/src/ln/outbound_payment.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,9 +1607,8 @@ impl OutboundPayments {
16071607
onion_error_data
16081608
} = onion_error.decode_onion_failure(secp_ctx, logger, &source);
16091609
#[cfg(not(test))]
1610-
let DecodedOnionFailure {
1611-
network_update, short_channel_id, payment_failed_permanently, onion_error_code,
1612-
} = onion_error.decode_onion_failure(secp_ctx, logger, &source);
1610+
let DecodedOnionFailure { network_update, short_channel_id, payment_failed_permanently } =
1611+
onion_error.decode_onion_failure(secp_ctx, logger, &source);
16131612

16141613
let payment_is_probe = payment_is_probe(payment_hash, &payment_id, probing_cookie_secret);
16151614
let mut session_priv_bytes = [0; 32];

0 commit comments

Comments
 (0)