From 4a0170a9417aaa3adac25e1d790031789d0de545 Mon Sep 17 00:00:00 2001 From: Valentine Wallace Date: Mon, 18 Dec 2023 14:15:48 -0500 Subject: [PATCH] Support forwarding blinded HTLCs as non-intro node. Error handling will be completed in upcoming commit(s). --- lightning/src/ln/msgs.rs | 4 ++-- lightning/src/ln/onion_payment.rs | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs index 1794aefe7..bc914ce49 100644 --- a/lightning/src/ln/msgs.rs +++ b/lightning/src/ln/msgs.rs @@ -1714,7 +1714,7 @@ mod fuzzy_internal_msgs { payment_relay: PaymentRelay, payment_constraints: PaymentConstraints, features: BlindedHopFeatures, - intro_node_blinding_point: PublicKey, + intro_node_blinding_point: Option, }, BlindedReceive { sender_intended_htlc_amt_msat: u64, @@ -2394,7 +2394,7 @@ impl ReadableArgs<(Option, &NS)> for InboundOnionPayload w payment_relay, payment_constraints, features, - intro_node_blinding_point: intro_node_blinding_point.ok_or(DecodeError::InvalidValue)?, + intro_node_blinding_point, }) }, ChaChaPolyReadAdapter { readable: BlindedPaymentTlvs::Receive(ReceiveTlvs { diff --git a/lightning/src/ln/onion_payment.rs b/lightning/src/ln/onion_payment.rs index c552bf13b..06dc7719b 100644 --- a/lightning/src/ln/onion_payment.rs +++ b/lightning/src/ln/onion_payment.rs @@ -73,7 +73,7 @@ pub(super) fn create_fwd_pending_htlc_info( }; let ( - short_channel_id, amt_to_forward, outgoing_cltv_value, inbound_blinding_point + short_channel_id, amt_to_forward, outgoing_cltv_value, intro_node_blinding_point ) = match hop_data { msgs::InboundOnionPayload::Forward { short_channel_id, amt_to_forward, outgoing_cltv_value } => (short_channel_id, amt_to_forward, outgoing_cltv_value, None), @@ -91,7 +91,7 @@ pub(super) fn create_fwd_pending_htlc_info( err_data: vec![0; 32], } })?; - (short_channel_id, amt_to_forward, outgoing_cltv_value, Some(intro_node_blinding_point)) + (short_channel_id, amt_to_forward, outgoing_cltv_value, intro_node_blinding_point) }, msgs::InboundOnionPayload::Receive { .. } | msgs::InboundOnionPayload::BlindedReceive { .. } => return Err(InboundHTLCErr { @@ -105,7 +105,8 @@ pub(super) fn create_fwd_pending_htlc_info( routing: PendingHTLCRouting::Forward { onion_packet: outgoing_packet, short_channel_id, - blinded: inbound_blinding_point.map(|bp| BlindedForward { inbound_blinding_point: bp }), + blinded: intro_node_blinding_point.or(msg.blinding_point) + .map(|bp| BlindedForward { inbound_blinding_point: bp }), }, payment_hash: msg.payment_hash, incoming_shared_secret: shared_secret, -- 2.39.5