Skip to content

Commit f64afa4

Browse files
committed
f: blinded tweak calculation
1 parent 7109ad0 commit f64afa4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lightning/src/ln/onion_utils.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -1595,11 +1595,18 @@ where
15951595
#[cfg(trampoline)]
15961596
msgs::InboundOnionPayload::TrampolineEntrypoint(hop_data) => {
15971597
let incoming_trampoline_public_key = hop_data.trampoline_packet.public_key;
1598+
let trampoline_blinded_node_id_tweak = hop_data.current_path_key.map(|bp| {
1599+
let blinded_tlvs_ss =
1600+
node_signer.ecdh(recipient, &bp, None).unwrap().secret_bytes();
1601+
let mut hmac = HmacEngine::<Sha256>::new(b"blinded_node_id");
1602+
hmac.input(blinded_tlvs_ss.as_ref());
1603+
Scalar::from_be_bytes(Hmac::from_engine(hmac).to_byte_array()).unwrap()
1604+
});
15981605
let trampoline_shared_secret = node_signer
15991606
.ecdh(
16001607
recipient,
16011608
&incoming_trampoline_public_key,
1602-
blinded_node_id_tweak.as_ref(),
1609+
trampoline_blinded_node_id_tweak.as_ref(),
16031610
)
16041611
.unwrap()
16051612
.secret_bytes();

0 commit comments

Comments
 (0)