Skip to content

Commit f317bb9

Browse files
committed
f Pull out one callback into dedicated variable
1 parent 0f50290 commit f317bb9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lightning/src/ln/onion_utils.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,7 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(
482482
const UPDATE: u16 = 0x1000;
483483

484484
// Handle packed channel/node updates for passing back for the route handler
485-
construct_onion_keys_callback(secp_ctx, &path, session_priv,
486-
|shared_secret, _, _, route_hop_opt, route_hop_idx|
485+
let callback = |shared_secret, _, _, route_hop_opt: Option<&RouteHop>, route_hop_idx|
487486
{
488487
if res.is_some() { return; }
489488

@@ -725,7 +724,11 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing, L: Deref>(
725724
} else {
726725
log_info!(logger, "Onion Error[from {}: {}({:#x})] {}", route_hop.pubkey, title, error_code, description);
727726
}
728-
}).expect("Route that we sent via spontaneously grew invalid keys in the middle of it?");
727+
};
728+
729+
construct_onion_keys_callback(secp_ctx, &path, session_priv, callback)
730+
.expect("Route that we sent via spontaneously grew invalid keys in the middle of it?");
731+
729732
if let Some(FailureLearnings {
730733
network_update, short_channel_id, payment_failed_permanently, failed_within_blinded_path
731734
}) = res {

0 commit comments

Comments
 (0)