#[inline]
pub(crate) fn construct_keys_callback<'a, T, I, F>(
- secp_ctx: &Secp256k1<T>, unblinded_path: I, destination: Option<Destination>,
- session_priv: &SecretKey, mut callback: F
+ secp_ctx: &Secp256k1<T>, unblinded_path: I, destination: Destination, session_priv: &SecretKey,
+ mut callback: F,
) -> Result<(), secp256k1::Error>
where
T: secp256k1::Signing + secp256k1::Verification,
for pk in unblinded_path {
build_keys_in_loop!(pk, false, None);
}
- if let Some(dest) = destination {
- match dest {
- Destination::Node(pk) => {
- build_keys!(pk, false, None);
- },
- Destination::BlindedPath(BlindedMessagePath(BlindedPath { blinded_hops, .. })) => {
- for hop in blinded_hops {
- build_keys_in_loop!(hop.blinded_node_id, true, Some(hop.encrypted_payload));
- }
- },
- }
+ match destination {
+ Destination::Node(pk) => {
+ build_keys!(pk, false, None);
+ },
+ Destination::BlindedPath(BlindedMessagePath(BlindedPath { blinded_hops, .. })) => {
+ for hop in blinded_hops {
+ build_keys_in_loop!(hop.blinded_node_id, true, Some(hop.encrypted_payload));
+ }
+ },
}
Ok(())
}
let mut prev_control_tlvs_ss = None;
let mut final_control_tlvs = None;
utils::construct_keys_callback(
- secp_ctx, unblinded_path.into_iter(), Some(destination), session_priv,
+ secp_ctx, unblinded_path.into_iter(), destination, session_priv,
|_, onion_packet_ss, ephemeral_pubkey, control_tlvs_ss, unblinded_pk_opt, enc_payload_opt| {
if num_unblinded_hops != 0 && unblinded_path_idx < num_unblinded_hops {
if let Some(ss) = prev_control_tlvs_ss.take() {