Support sending keysend payments to blinded paths.
authorValentine Wallace <vwallace@protonmail.com>
Wed, 13 Mar 2024 19:43:23 +0000 (15:43 -0400)
committerValentine Wallace <vwallace@protonmail.com>
Wed, 13 Mar 2024 19:47:52 +0000 (15:47 -0400)
lightning/src/ln/msgs.rs
lightning/src/ln/onion_utils.rs

index d291ac8664aceec5fdaff3b0d2ce20077e727028..a30bea5d37000335c0faf51deae2dcf72cd2d0ea 100644 (file)
@@ -1716,6 +1716,7 @@ mod fuzzy_internal_msgs {
                        cltv_expiry_height: u32,
                        encrypted_tlvs: Vec<u8>,
                        intro_node_blinding_point: Option<PublicKey>, // Set if the introduction node of the blinded path is the final node
+                       keysend_preimage: Option<PaymentPreimage>,
                }
        }
 
@@ -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)
                                });
                        },
                }
index c705c4afda8897d17dc2e81b50c27981cfd80a4b..53ef0729aa171ba56ff33ba73a55cb4ed922df83 100644 (file)
@@ -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 {