From: Jeffrey Czyz Date: Fri, 16 Aug 2024 15:12:24 +0000 (-0500) Subject: Require Destination in construct_keys_callback X-Git-Tag: v0.0.124-rc1~9^2~1 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=b4073b0a7f6cc4c6c37592df3b2c3dd21f802603;p=rust-lightning Require Destination in construct_keys_callback --- diff --git a/lightning/src/blinded_path/utils.rs b/lightning/src/blinded_path/utils.rs index a654ced66..8de36c1c8 100644 --- a/lightning/src/blinded_path/utils.rs +++ b/lightning/src/blinded_path/utils.rs @@ -89,8 +89,8 @@ macro_rules! build_keys_helper { #[inline] pub(crate) fn construct_keys_callback<'a, T, I, F>( - secp_ctx: &Secp256k1, unblinded_path: I, destination: Option, - session_priv: &SecretKey, mut callback: F + secp_ctx: &Secp256k1, unblinded_path: I, destination: Destination, session_priv: &SecretKey, + mut callback: F, ) -> Result<(), secp256k1::Error> where T: secp256k1::Signing + secp256k1::Verification, @@ -102,17 +102,15 @@ where 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(()) } diff --git a/lightning/src/onion_message/messenger.rs b/lightning/src/onion_message/messenger.rs index 4f862acfa..11a2d9f94 100644 --- a/lightning/src/onion_message/messenger.rs +++ b/lightning/src/onion_message/messenger.rs @@ -1810,7 +1810,7 @@ fn packet_payloads_and_keys