Skip to content

Commit b4073b0

Browse files
committed
Require Destination in construct_keys_callback
1 parent 2787ffe commit b4073b0

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

lightning/src/blinded_path/utils.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ macro_rules! build_keys_helper {
8989

9090
#[inline]
9191
pub(crate) fn construct_keys_callback<'a, T, I, F>(
92-
secp_ctx: &Secp256k1<T>, unblinded_path: I, destination: Option<Destination>,
93-
session_priv: &SecretKey, mut callback: F
92+
secp_ctx: &Secp256k1<T>, unblinded_path: I, destination: Destination, session_priv: &SecretKey,
93+
mut callback: F,
9494
) -> Result<(), secp256k1::Error>
9595
where
9696
T: secp256k1::Signing + secp256k1::Verification,
@@ -102,17 +102,15 @@ where
102102
for pk in unblinded_path {
103103
build_keys_in_loop!(pk, false, None);
104104
}
105-
if let Some(dest) = destination {
106-
match dest {
107-
Destination::Node(pk) => {
108-
build_keys!(pk, false, None);
109-
},
110-
Destination::BlindedPath(BlindedMessagePath(BlindedPath { blinded_hops, .. })) => {
111-
for hop in blinded_hops {
112-
build_keys_in_loop!(hop.blinded_node_id, true, Some(hop.encrypted_payload));
113-
}
114-
},
115-
}
105+
match destination {
106+
Destination::Node(pk) => {
107+
build_keys!(pk, false, None);
108+
},
109+
Destination::BlindedPath(BlindedMessagePath(BlindedPath { blinded_hops, .. })) => {
110+
for hop in blinded_hops {
111+
build_keys_in_loop!(hop.blinded_node_id, true, Some(hop.encrypted_payload));
112+
}
113+
},
116114
}
117115
Ok(())
118116
}

lightning/src/onion_message/messenger.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1810,7 +1810,7 @@ fn packet_payloads_and_keys<T: OnionMessageContents, S: secp256k1::Signing + sec
18101810
let mut prev_control_tlvs_ss = None;
18111811
let mut final_control_tlvs = None;
18121812
utils::construct_keys_callback(
1813-
secp_ctx, unblinded_path.into_iter(), Some(destination), session_priv,
1813+
secp_ctx, unblinded_path.into_iter(), destination, session_priv,
18141814
|_, onion_packet_ss, ephemeral_pubkey, control_tlvs_ss, unblinded_pk_opt, enc_payload_opt| {
18151815
if num_unblinded_hops != 0 && unblinded_path_idx < num_unblinded_hops {
18161816
if let Some(ss) = prev_control_tlvs_ss.take() {

0 commit comments

Comments
 (0)