Skip to content

Commit

Permalink
f Pull out one callback into dedicated variable
Browse files Browse the repository at this point in the history
  • Loading branch information
tnull committed Feb 12, 2024
1 parent 0f50290 commit f317bb9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lightning/src/ln/onion_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,7 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(
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; }

Expand Down Expand Up @@ -725,7 +724,11 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(
} 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 {
Expand Down

0 comments on commit f317bb9

Please sign in to comment.