From 658e2c0a48b50adb522cea30e05d88e824d45bd3 Mon Sep 17 00:00:00 2001 From: Valentine Wallace Date: Wed, 13 Mar 2024 15:43:23 -0400 Subject: [PATCH] Support sending keysend payments to blinded paths. --- lightning/src/ln/msgs.rs | 6 ++++-- lightning/src/ln/onion_utils.rs | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs index d291ac866..a30bea5d3 100644 --- a/lightning/src/ln/msgs.rs +++ b/lightning/src/ln/msgs.rs @@ -1716,6 +1716,7 @@ mod fuzzy_internal_msgs { cltv_expiry_height: u32, encrypted_tlvs: Vec, intro_node_blinding_point: Option, // Set if the introduction node of the blinded path is the final node + keysend_preimage: Option, } } @@ -2503,14 +2504,15 @@ impl Writeable for OutboundOnionPayload { }, Self::BlindedReceive { sender_intended_htlc_amt_msat, total_msat, cltv_expiry_height, encrypted_tlvs, - intro_node_blinding_point, + intro_node_blinding_point, keysend_preimage, } => { _encode_varint_length_prefixed_tlv!(w, { (2, HighZeroBytesDroppedBigSize(*sender_intended_htlc_amt_msat), required), (4, HighZeroBytesDroppedBigSize(*cltv_expiry_height), required), (10, *encrypted_tlvs, required_vec), (12, intro_node_blinding_point, option), - (18, HighZeroBytesDroppedBigSize(*total_msat), required) + (18, HighZeroBytesDroppedBigSize(*total_msat), required), + (5482373484, keysend_preimage, option) }); }, } diff --git a/lightning/src/ln/onion_utils.rs b/lightning/src/ln/onion_utils.rs index c705c4afd..53ef0729a 100644 --- a/lightning/src/ln/onion_utils.rs +++ b/lightning/src/ln/onion_utils.rs @@ -213,6 +213,7 @@ pub(super) fn build_onion_payloads( cltv_expiry_height: cur_cltv + excess_final_cltv_expiry_delta, encrypted_tlvs: blinded_hop.encrypted_payload.clone(), intro_node_blinding_point: blinding_point.take(), + keysend_preimage: *keysend_preimage, }); } else { res.push(msgs::OutboundOnionPayload::BlindedForward { -- 2.39.5