From f317bb9dbf7e67e1f8f776998ae09901fef42863 Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Mon, 12 Feb 2024 19:15:59 +0100 Subject: [PATCH] f Pull out one callback into dedicated variable --- lightning/src/ln/onion_utils.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lightning/src/ln/onion_utils.rs b/lightning/src/ln/onion_utils.rs index e4784cdc4d9..719474046b1 100644 --- a/lightning/src/ln/onion_utils.rs +++ b/lightning/src/ln/onion_utils.rs @@ -482,8 +482,7 @@ pub(super) fn process_onion_failure( const UPDATE: u16 = 0x1000; // Handle packed channel/node updates for passing back for the route handler - construct_onion_keys_callback(secp_ctx, &path, session_priv, - |shared_secret, _, _, route_hop_opt, route_hop_idx| + let callback = |shared_secret, _, _, route_hop_opt: Option<&RouteHop>, route_hop_idx| { if res.is_some() { return; } @@ -725,7 +724,11 @@ pub(super) fn process_onion_failure( } else { log_info!(logger, "Onion Error[from {}: {}({:#x})] {}", route_hop.pubkey, title, error_code, description); } - }).expect("Route that we sent via spontaneously grew invalid keys in the middle of it?"); + }; + + construct_onion_keys_callback(secp_ctx, &path, session_priv, callback) + .expect("Route that we sent via spontaneously grew invalid keys in the middle of it?"); + if let Some(FailureLearnings { network_update, short_channel_id, payment_failed_permanently, failed_within_blinded_path }) = res {