]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Stop taking &self in outbound_payments' create_inbound_payment
authorValentine Wallace <vwallace@protonmail.com>
Wed, 30 Oct 2024 15:39:52 +0000 (11:39 -0400)
committerValentine Wallace <vwallace@protonmail.com>
Wed, 30 Oct 2024 20:14:03 +0000 (16:14 -0400)
The method doesn't actually use its &self parameter, and this makes it more
obvious that we aren't going to deadlock by calling the method if the
outbound_payments lock is already acquired.

lightning/src/ln/outbound_payment.rs

index 9c8998b8970f9a7da6fda93ebc10ea1b2df89b13..04736f2a8c2cc65a5107d2cdeb5f5178c9e23aac 100644 (file)
@@ -945,7 +945,7 @@ impl OutboundPayments {
                };
 
                let payment_params = Some(route_params.payment_params.clone());
-               let (retryable_payment, onion_session_privs) = self.create_pending_payment(
+               let (retryable_payment, onion_session_privs) = Self::create_pending_payment(
                        payment_hash, recipient_onion.clone(), keysend_preimage, &route, Some(retry_strategy),
                        payment_params, entropy_source, best_block_height
                );
@@ -1546,7 +1546,7 @@ impl OutboundPayments {
                match pending_outbounds.entry(payment_id) {
                        hash_map::Entry::Occupied(_) => Err(PaymentSendFailure::DuplicatePayment),
                        hash_map::Entry::Vacant(entry) => {
-                               let (payment, onion_session_privs) = self.create_pending_payment(
+                               let (payment, onion_session_privs) = Self::create_pending_payment(
                                        payment_hash, recipient_onion, keysend_preimage, route, retry_strategy,
                                        payment_params, entropy_source, best_block_height
                                );
@@ -1557,7 +1557,7 @@ impl OutboundPayments {
        }
 
        fn create_pending_payment<ES: Deref>(
-               &self, payment_hash: PaymentHash, recipient_onion: RecipientOnionFields,
+               payment_hash: PaymentHash, recipient_onion: RecipientOnionFields,
                keysend_preimage: Option<PaymentPreimage>, route: &Route, retry_strategy: Option<Retry>,
                payment_params: Option<PaymentParameters>, entropy_source: &ES, best_block_height: u32
        ) -> (PendingOutboundPayment, Vec<[u8; 32]>)