]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Remove special case for onion error expiry_too_far
authorJeffrey Czyz <jkczyz@gmail.com>
Mon, 20 Sep 2021 16:25:39 +0000 (11:25 -0500)
committerJeffrey Czyz <jkczyz@gmail.com>
Thu, 7 Oct 2021 04:31:27 +0000 (23:31 -0500)
With channel scoring and payment retries, it is no longer necessary to
have expiry_too_far imply a payment failure.

lightning/src/ln/onion_route_tests.rs
lightning/src/ln/onion_utils.rs

index 0e2d081c83bf862c7a3a80165c9f78b8e87ba1ec..4ad15bd420fe0ea0552ce883f47e6879e97b7d31 100644 (file)
@@ -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}));
 }
 
 
index ee3ed96b5ef0efdcaaeda40a32f2e71653948ac0..f1b617fd94f3376810f4faeac69c9ce64702c27d 100644 (file)
@@ -377,11 +377,10 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(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;