/// The SCID from the onion that we should forward to. This could be a real SCID or a fake one
/// generated using `get_fake_scid` from the scid_utils::fake_scid module.
short_channel_id: u64, // This should be NonZero<u64> eventually when we bump MSRV
+ /// Set if this HTLC is being forwarded within a blinded path.
+ blinded: Option<BlindedForward>,
},
/// An HTLC paid to an invoice (supposedly) generated by us.
/// At this point, we have not checked that the invoice being paid was actually generated by us,
},
}
+/// Information used to forward or fail this HTLC that is being forwarded within a blinded path.
+#[derive(Clone, Copy, Hash, PartialEq, Eq)]
+pub struct BlindedForward {
+ /// The `blinding_point` that was set in the inbound [`msgs::UpdateAddHTLC`], or in the inbound
+ /// onion payload if we're the introduction node. Useful for calculating the next hop's
+ /// [`msgs::UpdateAddHTLC::blinding_point`].
+ pub inbound_blinding_point: PublicKey,
+ // Another field will be added here when we support forwarding as a non-intro node.
+}
+
/// Full details of an incoming HTLC, including routing info.
#[derive(Clone)] // See Channel::revoke_and_ack for why, tl;dr: Rust bug
pub struct PendingHTLCInfo {
})?;
let routing = match payment.forward_info.routing {
- PendingHTLCRouting::Forward { onion_packet, .. } => {
- PendingHTLCRouting::Forward { onion_packet, short_channel_id: next_hop_scid }
+ PendingHTLCRouting::Forward { onion_packet, blinded, .. } => {
+ PendingHTLCRouting::Forward {
+ onion_packet, blinded, short_channel_id: next_hop_scid
+ }
},
_ => unreachable!() // Only `PendingHTLCRouting::Forward`s are intercepted
};
(6, real_node_pubkey, required),
});
+impl_writeable_tlv_based!(BlindedForward, {
+ (0, inbound_blinding_point, required),
+});
+
impl_writeable_tlv_based_enum!(PendingHTLCRouting,
(0, Forward) => {
(0, onion_packet, required),
+ (1, blinded, option),
(2, short_channel_id, required),
},
(1, Receive) => {
routing: PendingHTLCRouting::Forward {
onion_packet: outgoing_packet,
short_channel_id,
+ blinded: None,
},
payment_hash: msg.payment_hash,
incoming_shared_secret: shared_secret,
.map_err(|e| e.msg).unwrap();
let next_onion = match peeled.routing {
- PendingHTLCRouting::Forward { onion_packet, short_channel_id: _ } => {
+ PendingHTLCRouting::Forward { onion_packet, .. } => {
onion_packet
},
_ => panic!("expected a forwarded onion"),