Skip to content

Commit 98a5db3

Browse files
committed
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.
1 parent 4cd446e commit 98a5db3

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

lightning/src/ln/msgs.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,6 +1860,18 @@ mod fuzzy_internal_msgs {
18601860
multipath_trampoline_data: Option<FinalOnionHopData>,
18611861
trampoline_packet: TrampolineOnionPacket,
18621862
},
1863+
/// This is used for Trampoline hops that are not the blinded path intro hop.
1864+
/// We would only ever construct this variant when we are a Trampoline node forwarding a
1865+
/// payment along a blinded path.
1866+
#[allow(unused)]
1867+
BlindedTrampolineEntrypoint {
1868+
amt_to_forward: u64,
1869+
outgoing_cltv_value: u32,
1870+
multipath_trampoline_data: Option<FinalOnionHopData>,
1871+
trampoline_packet: TrampolineOnionPacket,
1872+
/// The blinding point this hop needs to use for its Trampoline onion.
1873+
current_path_key: PublicKey
1874+
},
18631875
Receive {
18641876
payment_data: Option<FinalOnionHopData>,
18651877
payment_metadata: Option<&'a Vec<u8>>,
@@ -2794,6 +2806,18 @@ impl<'a> Writeable for OutboundOnionPayload<'a> {
27942806
(20, trampoline_packet, required)
27952807
});
27962808
},
2809+
Self::BlindedTrampolineEntrypoint {
2810+
amt_to_forward, outgoing_cltv_value, current_path_key,
2811+
ref multipath_trampoline_data, ref trampoline_packet
2812+
} => {
2813+
_encode_varint_length_prefixed_tlv!(w, {
2814+
(2, HighZeroBytesDroppedBigSize(*amt_to_forward), required),
2815+
(4, HighZeroBytesDroppedBigSize(*outgoing_cltv_value), required),
2816+
(8, multipath_trampoline_data, option),
2817+
(12, current_path_key, required),
2818+
(20, trampoline_packet, required)
2819+
});
2820+
},
27972821
Self::Receive {
27982822
ref payment_data, ref payment_metadata, ref keysend_preimage, sender_intended_htlc_amt_msat,
27992823
cltv_expiry_height, ref custom_tlvs,

0 commit comments

Comments
 (0)