]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Set `payment_secret` when sending probes
authorElias Rohrer <dev@tnull.de>
Mon, 28 Aug 2023 11:57:29 +0000 (13:57 +0200)
committerElias Rohrer <dev@tnull.de>
Wed, 13 Sep 2023 09:52:45 +0000 (11:52 +0200)
Previously, we'd leave the payment secret field empty while sending
probes, which resulted in having them rejected
with `(PERM|invalid_onion_payload)` by Eclair nodes.

In order to mitigate the issue, we just set a random payment secret.

lightning/src/ln/outbound_payment.rs

index 0cc9e7e0531fb3bb6d1bc0d7dd38bff274b8333e..127e73c20f8044be5749947fbce14560296974c6 100644 (file)
@@ -1103,6 +1103,7 @@ impl OutboundPayments {
                F: Fn(SendAlongPathArgs) -> Result<(), APIError>,
        {
                let payment_id = PaymentId(entropy_source.get_secure_random_bytes());
+               let payment_secret = PaymentSecret(entropy_source.get_secure_random_bytes());
 
                let payment_hash = probing_cookie_from_id(&payment_id, probing_cookie_secret);
 
@@ -1114,7 +1115,7 @@ impl OutboundPayments {
 
                let route = Route { paths: vec![path], route_params: None };
                let onion_session_privs = self.add_new_pending_payment(payment_hash,
-                       RecipientOnionFields::spontaneous_empty(), payment_id, None, &route, None, None,
+                       RecipientOnionFields::secret_only(payment_secret), payment_id, None, &route, None, None,
                        entropy_source, best_block_height)?;
 
                match self.pay_route_internal(&route, payment_hash, RecipientOnionFields::spontaneous_empty(),