]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Use CLTV_FAR_FAR_AWAY in PaymentConstraints
authorJeffrey Czyz <jkczyz@gmail.com>
Fri, 15 Dec 2023 21:37:18 +0000 (15:37 -0600)
committerJeffrey Czyz <jkczyz@gmail.com>
Fri, 15 Dec 2023 21:37:18 +0000 (15:37 -0600)
When finding a route through a blinded path, a random CLTV offset may be
added to the path in order to preserve privacy. This needs to be
accounted for in the blinded path's PaymentConstraints. Add
CLTV_FAR_FAR_AWAY to the max_cltv_expiry constraint to allow for such
offsets.

lightning/src/ln/channelmanager.rs

index 9017f3ffd98a4708274d2b005f6d17a91583e7aa..dccc53ae813eb097aeecabe9a44bbffc51b25421 100644 (file)
@@ -7876,7 +7876,8 @@ where
                let secp_ctx = &self.secp_ctx;
 
                let payee_node_id = self.get_our_node_id();
-               let max_cltv_expiry = self.best_block.read().unwrap().height() + LATENCY_GRACE_PERIOD_BLOCKS;
+               let max_cltv_expiry = self.best_block.read().unwrap().height() + CLTV_FAR_FAR_AWAY
+                       + LATENCY_GRACE_PERIOD_BLOCKS;
                let payee_tlvs = ReceiveTlvs {
                        payment_secret,
                        payment_constraints: PaymentConstraints {