Skip to content

Commit 47f02f1

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 4ce4a0a commit 47f02f1

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
@@ -2122,6 +2122,18 @@ mod fuzzy_internal_msgs {
21222122
multipath_trampoline_data: Option<FinalOnionHopData>,
21232123
trampoline_packet: TrampolineOnionPacket,
21242124
},
2125+
/// This is used for Trampoline hops that are not the blinded path intro hop.
2126+
/// We would only ever construct this variant when we are a Trampoline node forwarding a
2127+
/// payment along a blinded path.
2128+
#[allow(unused)]
2129+
BlindedTrampolineEntrypoint {
2130+
amt_to_forward: u64,
2131+
outgoing_cltv_value: u32,
2132+
multipath_trampoline_data: Option<FinalOnionHopData>,
2133+
trampoline_packet: TrampolineOnionPacket,
2134+
/// The blinding point this hop needs to use for its Trampoline onion.
2135+
current_path_key: PublicKey
2136+
},
21252137
Receive {
21262138
payment_data: Option<FinalOnionHopData>,
21272139
payment_metadata: Option<&'a Vec<u8>>,
@@ -3056,6 +3068,18 @@ impl<'a> Writeable for OutboundOnionPayload<'a> {
30563068
(20, trampoline_packet, required)
30573069
});
30583070
},
3071+
Self::BlindedTrampolineEntrypoint {
3072+
amt_to_forward, outgoing_cltv_value, current_path_key,
3073+
ref multipath_trampoline_data, ref trampoline_packet
3074+
} => {
3075+
_encode_varint_length_prefixed_tlv!(w, {
3076+
(2, HighZeroBytesDroppedBigSize(*amt_to_forward), required),
3077+
(4, HighZeroBytesDroppedBigSize(*outgoing_cltv_value), required),
3078+
(8, multipath_trampoline_data, option),
3079+
(12, current_path_key, required),
3080+
(20, trampoline_packet, required)
3081+
});
3082+
},
30593083
Self::Receive {
30603084
ref payment_data, ref payment_metadata, ref keysend_preimage, sender_intended_htlc_amt_msat,
30613085
cltv_expiry_height, ref custom_tlvs,

0 commit comments

Comments
 (0)