Skip to content

Commit ab5355a

Browse files
Add node_id field to DecodedOnionFailure.
Will be used to ensure correctness when we store previously failed blinded paths to avoid retrying over them.
1 parent de54cad commit ab5355a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lightning/src/ln/onion_utils.rs

Lines changed: 4 additions & 2 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+
pub(crate) node_id: Option<PublicKey>,
432433
pub(crate) onion_error_code: Option<u16>,
433434
#[cfg(test)]
434435
pub(crate) onion_error_data: Option<Vec<u8>>,
@@ -724,7 +725,7 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(
724725
network_update, short_channel_id, payment_failed_permanently, node_id
725726
}) = res {
726727
DecodedOnionFailure {
727-
network_update, short_channel_id, payment_failed_permanently,
728+
network_update, short_channel_id, payment_failed_permanently, node_id,
728729
onion_error_code: error_code_ret,
729730
#[cfg(test)]
730731
onion_error_data: error_packet_ret
@@ -734,7 +735,7 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(
734735
// payment not retryable only when garbage is from the final node
735736
DecodedOnionFailure {
736737
network_update: None, short_channel_id: None, payment_failed_permanently: is_from_final_node,
737-
onion_error_code: None,
738+
node_id: None, onion_error_code: None,
738739
#[cfg(test)]
739740
onion_error_data: None
740741
}
@@ -880,6 +881,7 @@ impl HTLCFailReason {
880881
network_update: None,
881882
payment_failed_permanently: false,
882883
short_channel_id: Some(path.hops[0].short_channel_id),
884+
node_id: Some(path.hops[0].pubkey),
883885
onion_error_code: Some(*failure_code),
884886
#[cfg(test)]
885887
onion_error_data: Some(data.clone()),

lightning/src/ln/outbound_payment.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,11 +1609,11 @@ impl OutboundPayments {
16091609
#[cfg(test)]
16101610
let DecodedOnionFailure {
16111611
network_update, short_channel_id, payment_failed_permanently, onion_error_code,
1612-
onion_error_data
1612+
onion_error_data, node_id
16131613
} = onion_error.decode_onion_failure(secp_ctx, logger, &source);
16141614
#[cfg(not(test))]
16151615
let DecodedOnionFailure {
1616-
network_update, short_channel_id, payment_failed_permanently, onion_error_code,
1616+
network_update, short_channel_id, payment_failed_permanently, onion_error_code, node_id
16171617
} = onion_error.decode_onion_failure(secp_ctx, logger, &source);
16181618

16191619
let payment_is_probe = payment_is_probe(payment_hash, &payment_id, probing_cookie_secret);

0 commit comments

Comments
 (0)