@@ -119,6 +119,8 @@ pub enum PendingHTLCRouting {
119119 /// The SCID from the onion that we should forward to. This could be a real SCID or a fake one
120120 /// generated using `get_fake_scid` from the scid_utils::fake_scid module.
121121 short_channel_id: u64, // This should be NonZero<u64> eventually when we bump MSRV
122+ /// Set if this HTLC is being forwarded within a blinded path.
123+ blinded: Option<BlindedForward>,
122124 },
123125 /// An HTLC paid to an invoice (supposedly) generated by us.
124126 /// At this point, we have not checked that the invoice being paid was actually generated by us,
@@ -155,6 +157,16 @@ pub enum PendingHTLCRouting {
155157 },
156158}
157159
160+ /// Information used to forward or fail this HTLC that is being forwarded within a blinded path.
161+ #[derive(Clone, Copy, Hash, PartialEq, Eq)]
162+ pub struct BlindedForward {
163+ /// The `blinding_point` that was set in the inbound [`msgs::UpdateAddHTLC`], or in the inbound
164+ /// onion payload if we're the introduction node. Useful for calculating the next hop's
165+ /// [`msgs::UpdateAddHTLC::blinding_point`].
166+ pub inbound_blinding_point: PublicKey,
167+ // Another field will be added here when we support forwarding as a non-intro node.
168+ }
169+
158170/// Full details of an incoming HTLC, including routing info.
159171#[derive(Clone)] // See Channel::revoke_and_ack for why, tl;dr: Rust bug
160172pub struct PendingHTLCInfo {
@@ -4013,8 +4025,10 @@ where
40134025 })?;
40144026
40154027 let routing = match payment.forward_info.routing {
4016- PendingHTLCRouting::Forward { onion_packet, .. } => {
4017- PendingHTLCRouting::Forward { onion_packet, short_channel_id: next_hop_scid }
4028+ PendingHTLCRouting::Forward { onion_packet, blinded, .. } => {
4029+ PendingHTLCRouting::Forward {
4030+ onion_packet, blinded, short_channel_id: next_hop_scid
4031+ }
40184032 },
40194033 _ => unreachable!() // Only `PendingHTLCRouting::Forward`s are intercepted
40204034 };
@@ -9143,9 +9157,14 @@ impl_writeable_tlv_based!(PhantomRouteHints, {
91439157 (6, real_node_pubkey, required),
91449158});
91459159
9160+ impl_writeable_tlv_based!(BlindedForward, {
9161+ (0, inbound_blinding_point, required),
9162+ });
9163+
91469164impl_writeable_tlv_based_enum!(PendingHTLCRouting,
91479165 (0, Forward) => {
91489166 (0, onion_packet, required),
9167+ (1, blinded, option),
91499168 (2, short_channel_id, required),
91509169 },
91519170 (1, Receive) => {
0 commit comments