From: Jeffrey Czyz Date: Mon, 20 Sep 2021 16:25:39 +0000 (-0500) Subject: Remove special case for onion error expiry_too_far X-Git-Tag: v0.0.102~7^2~3 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=42bb0af11d1e2b35cc1be9cf99ff57c9b52f0004;p=rust-lightning 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. --- diff --git a/lightning/src/ln/onion_route_tests.rs b/lightning/src/ln/onion_route_tests.rs index 0e2d081c8..4ad15bd42 100644 --- a/lightning/src/ln/onion_route_tests.rs +++ b/lightning/src/ln/onion_route_tests.rs @@ -538,7 +538,7 @@ fn test_onion_failure() { let onion_packet = onion_utils::construct_onion_packet(onion_payloads, onion_keys, [0; 32], &payment_hash); msg.cltv_expiry = htlc_cltv; msg.onion_routing_packet = onion_packet; - }, ||{}, true, Some(21), None); + }, ||{}, true, Some(21), Some(NetworkUpdate::NodeFailure{node_id: route.paths[0][0].pubkey, is_permanent: true})); } diff --git a/lightning/src/ln/onion_utils.rs b/lightning/src/ln/onion_utils.rs index ee3ed96b5..f1b617fd9 100644 --- a/lightning/src/ln/onion_utils.rs +++ b/lightning/src/ln/onion_utils.rs @@ -377,11 +377,10 @@ pub(super) fn process_onion_failure(secp_ctx: & // indicate that payment parameter has failed and no need to // update Route object - let payment_failed = (match error_code & 0xff { + let payment_failed = match error_code & 0xff { 15|16|17|18|19 => true, _ => false, - } && is_from_final_node) // PERM bit observed below even this error is from the intermediate nodes - || error_code == 21; // Special case error 21 as the Route object is bogus, TODO: Maybe fail the node if the CLTV was reasonable? + } && is_from_final_node; // PERM bit observed below even if this error is from the intermediate nodes let mut network_update = None;