Create blinded TrampolineEntrypoint variant

Given that blinded Trampoline hops cannot use blinded intermediate hops
between each other, the `current_path_key` used for decrypting the
blinded Trampoline onion cannot be included in the update_add_htlc
message due to the potential presence of intermediate hops.

That means that when we're not the payment initiator, but a Trampoline
hop forwarding a payment along a blinded path, we must include the
blinding point inside the outer onion, which this commit will allow us
to do.
This commit is contained in:
Arik Sosman 2025-02-27 10:57:56 -08:00
parent 8025e33713
commit 56caad8728
No known key found for this signature in database
GPG key ID: CFF795E7811C0093

View file

@ -2122,6 +2122,18 @@ mod fuzzy_internal_msgs {
multipath_trampoline_data: Option<FinalOnionHopData>,
trampoline_packet: TrampolineOnionPacket,
},
/// This is used for Trampoline hops that are not the blinded path intro hop.
/// We would only ever construct this variant when we are a Trampoline node forwarding a
/// payment along a blinded path.
#[allow(unused)]
BlindedTrampolineEntrypoint {
amt_to_forward: u64,
outgoing_cltv_value: u32,
multipath_trampoline_data: Option<FinalOnionHopData>,
trampoline_packet: TrampolineOnionPacket,
/// The blinding point this hop needs to use for its Trampoline onion.
current_path_key: PublicKey
},
Receive {
payment_data: Option<FinalOnionHopData>,
payment_metadata: Option<&'a Vec<u8>>,
@ -3056,6 +3068,18 @@ impl<'a> Writeable for OutboundOnionPayload<'a> {
(20, trampoline_packet, required)
});
},
Self::BlindedTrampolineEntrypoint {
amt_to_forward, outgoing_cltv_value, current_path_key,
ref multipath_trampoline_data, ref trampoline_packet
} => {
_encode_varint_length_prefixed_tlv!(w, {
(2, HighZeroBytesDroppedBigSize(*amt_to_forward), required),
(4, HighZeroBytesDroppedBigSize(*outgoing_cltv_value), required),
(8, multipath_trampoline_data, option),
(12, current_path_key, required),
(20, trampoline_packet, required)
});
},
Self::Receive {
ref payment_data, ref payment_metadata, ref keysend_preimage, sender_intended_htlc_amt_msat,
cltv_expiry_height, ref custom_tlvs,