Skip to content

Commit 42bb0af

Browse files
committed
Remove special case for onion error expiry_too_far
With channel scoring and payment retries, it is no longer necessary to have expiry_too_far imply a payment failure.
1 parent ad819ea commit 42bb0af

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

lightning/src/ln/onion_route_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ fn test_onion_failure() {
538538
let onion_packet = onion_utils::construct_onion_packet(onion_payloads, onion_keys, [0; 32], &payment_hash);
539539
msg.cltv_expiry = htlc_cltv;
540540
msg.onion_routing_packet = onion_packet;
541-
}, ||{}, true, Some(21), None);
541+
}, ||{}, true, Some(21), Some(NetworkUpdate::NodeFailure{node_id: route.paths[0][0].pubkey, is_permanent: true}));
542542
}
543543

544544

lightning/src/ln/onion_utils.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,11 +377,10 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(secp_ctx: &
377377

378378
// indicate that payment parameter has failed and no need to
379379
// update Route object
380-
let payment_failed = (match error_code & 0xff {
380+
let payment_failed = match error_code & 0xff {
381381
15|16|17|18|19 => true,
382382
_ => false,
383-
} && is_from_final_node) // PERM bit observed below even this error is from the intermediate nodes
384-
|| error_code == 21; // Special case error 21 as the Route object is bogus, TODO: Maybe fail the node if the CLTV was reasonable?
383+
} && is_from_final_node; // PERM bit observed below even if this error is from the intermediate nodes
385384

386385
let mut network_update = None;
387386

0 commit comments

Comments
 (0)