@@ -6207,25 +6207,31 @@ where
6207
6207
HTLCForwardInfo::AddHTLC(PendingAddHTLCInfo {
6208
6208
prev_short_channel_id, prev_htlc_id, prev_channel_id, prev_funding_outpoint,
6209
6209
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,
6211
6211
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, ..
6213
6213
}, skimmed_fee_msat, incoming_amt_msat
6214
6214
},
6215
6215
}) => {
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
+ };
6229
6235
let next_blinding_point = blinded.and_then(|b| {
6230
6236
b.next_blinding_override.or_else(|| {
6231
6237
let encrypted_tlvs_ss = self.node_signer.ecdh(
@@ -6281,8 +6287,7 @@ where
6281
6287
}
6282
6288
}
6283
6289
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(|_| {
6286
6291
APIError::InvalidRoute { err: "Pubkey along hop was maliciously selected".to_owned() }
6287
6292
}).unwrap();
6288
6293
let outer_onion_prng_seed = self.entropy_source.get_secure_random_bytes();
0 commit comments