@@ -6207,25 +6207,31 @@ where
62076207 HTLCForwardInfo::AddHTLC(PendingAddHTLCInfo {
62086208 prev_short_channel_id, prev_htlc_id, prev_channel_id, prev_funding_outpoint,
62096209 prev_user_channel_id, prev_counterparty_node_id, forward_info: PendingHTLCInfo {
6210- incoming_shared_secret, payment_hash, outgoing_amt_msat, outgoing_cltv_value,
6210+ incoming_shared_secret: incoming_outer_shared_secret , payment_hash, outgoing_amt_msat, outgoing_cltv_value,
62116211 routing: PendingHTLCRouting::TrampolineForward {
6212- ref onion_packet, blinded, incoming_cltv_expiry, ref hops, ..
6212+ ref onion_packet, blinded, incoming_cltv_expiry, incoming_shared_secret: incoming_trampoline_shared_secret, ref hops, ..
62136213 }, skimmed_fee_msat, incoming_amt_msat
62146214 },
62156215 }) => {
6216- let htlc_source = HTLCSource::PreviousHopData(HTLCPreviousHopData {
6217- short_channel_id: prev_short_channel_id,
6218- user_channel_id: Some(prev_user_channel_id),
6219- counterparty_node_id: prev_counterparty_node_id,
6220- channel_id: prev_channel_id,
6221- outpoint: prev_funding_outpoint,
6222- htlc_id: prev_htlc_id,
6223- incoming_packet_shared_secret: incoming_shared_secret,
6224- // Phantom payments are only PendingHTLCRouting::Receive.
6225- phantom_shared_secret: None,
6226- blinded_failure: blinded.map(|b| b.failure),
6227- cltv_expiry: Some(incoming_cltv_expiry),
6228- });
6216+ let inter_trampoline_session_priv = SecretKey::from_slice(&self.entropy_source.get_secure_random_bytes()).unwrap();
6217+ let htlc_source = HTLCSource::TrampolineForward {
6218+ session_priv: inter_trampoline_session_priv,
6219+ previous_hop_data: HTLCPreviousHopData {
6220+ short_channel_id: prev_short_channel_id,
6221+ user_channel_id: Some(prev_user_channel_id),
6222+ counterparty_node_id: prev_counterparty_node_id,
6223+ channel_id: prev_channel_id,
6224+ outpoint: prev_funding_outpoint,
6225+ htlc_id: prev_htlc_id,
6226+ incoming_packet_shared_secret: incoming_outer_shared_secret,
6227+ // Phantom payments are only PendingHTLCRouting::Receive.
6228+ phantom_shared_secret: None,
6229+ blinded_failure: blinded.map(|b| b.failure),
6230+ cltv_expiry: Some(incoming_cltv_expiry),
6231+ },
6232+ incoming_trampoline_shared_secret,
6233+ hops: hops.clone(),
6234+ };
62296235 let next_blinding_point = blinded.and_then(|b| {
62306236 b.next_blinding_override.or_else(|| {
62316237 let encrypted_tlvs_ss = self.node_signer.ecdh(
@@ -6281,8 +6287,7 @@ where
62816287 }
62826288 }
62836289
6284- let outer_session_priv = SecretKey::from_slice(&self.entropy_source.get_secure_random_bytes()).unwrap();
6285- let onion_keys = onion_utils::construct_onion_keys(&self.secp_ctx, &path, &outer_session_priv).map_err(|_| {
6290+ let onion_keys = onion_utils::construct_onion_keys(&self.secp_ctx, &path, &inter_trampoline_session_priv).map_err(|_| {
62866291 APIError::InvalidRoute { err: "Pubkey along hop was maliciously selected".to_owned() }
62876292 }).unwrap();
62886293 let outer_onion_prng_seed = self.entropy_source.get_secure_random_bytes();
0 commit comments