Skip to content

Commit fec26ee

Browse files
committed
Parse path_key for blinded Trampoline entry points
Given that blinded Trampoline hops cannot use blinded intermediate hops between each other, the `current_path_key` used for decrypting the blinded Trampoline onion needs to be provided as part of the un-blinded outer onion. In that scenario, the rest of the outer onion is not blinded, however, so the field needs to be handled differently than an `intro_node_blinding_point`.
1 parent e07a436 commit fec26ee

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

lightning/src/ln/msgs.rs

+13-11
Original file line numberDiff line numberDiff line change
@@ -1817,6 +1817,7 @@ mod fuzzy_internal_msgs {
18171817
pub outgoing_cltv_value: u32,
18181818
pub multipath_trampoline_data: Option<FinalOnionHopData>,
18191819
pub trampoline_packet: TrampolineOnionPacket,
1820+
pub current_path_key: Option<PublicKey>
18201821
}
18211822

18221823
pub struct InboundOnionReceivePayload {
@@ -2974,7 +2975,18 @@ impl<NS: Deref> ReadableArgs<(Option<PublicKey>, NS)> for InboundOnionPayload wh
29742975
return Err(DecodeError::InvalidValue)
29752976
}
29762977

2977-
if let Some(blinding_point) = intro_node_blinding_point.or(update_add_blinding_point) {
2978+
if let Some(trampoline_onion_packet) = trampoline_onion_packet {
2979+
if payment_metadata.is_some() || encrypted_tlvs_opt.is_some() ||
2980+
total_msat.is_some()
2981+
{ return Err(DecodeError::InvalidValue) }
2982+
Ok(Self::TrampolineEntrypoint(InboundTrampolineEntrypointPayload {
2983+
amt_to_forward: amt.ok_or(DecodeError::InvalidValue)?,
2984+
outgoing_cltv_value: cltv_value.ok_or(DecodeError::InvalidValue)?,
2985+
multipath_trampoline_data: payment_data,
2986+
trampoline_packet: trampoline_onion_packet,
2987+
current_path_key: intro_node_blinding_point
2988+
}))
2989+
} else if let Some(blinding_point) = intro_node_blinding_point.or(update_add_blinding_point) {
29782990
if short_id.is_some() || payment_data.is_some() || payment_metadata.is_some() {
29792991
return Err(DecodeError::InvalidValue)
29802992
}
@@ -3036,16 +3048,6 @@ impl<NS: Deref> ReadableArgs<(Option<PublicKey>, NS)> for InboundOnionPayload wh
30363048
amt_to_forward: amt.ok_or(DecodeError::InvalidValue)?,
30373049
outgoing_cltv_value: cltv_value.ok_or(DecodeError::InvalidValue)?,
30383050
}))
3039-
} else if let Some(trampoline_onion_packet) = trampoline_onion_packet {
3040-
if payment_metadata.is_some() || encrypted_tlvs_opt.is_some() ||
3041-
total_msat.is_some()
3042-
{ return Err(DecodeError::InvalidValue) }
3043-
Ok(Self::TrampolineEntrypoint(InboundTrampolineEntrypointPayload {
3044-
amt_to_forward: amt.ok_or(DecodeError::InvalidValue)?,
3045-
outgoing_cltv_value: cltv_value.ok_or(DecodeError::InvalidValue)?,
3046-
multipath_trampoline_data: payment_data,
3047-
trampoline_packet: trampoline_onion_packet,
3048-
}))
30493051
} else {
30503052
if encrypted_tlvs_opt.is_some() || total_msat.is_some() || invoice_request.is_some() {
30513053
return Err(DecodeError::InvalidValue)

0 commit comments

Comments
 (0)