Rename send_payment and retry_payment for retries
authorValentine Wallace <vwallace@protonmail.com>
Mon, 19 Dec 2022 01:34:34 +0000 (20:34 -0500)
committerValentine Wallace <vwallace@protonmail.com>
Tue, 20 Dec 2022 02:08:08 +0000 (21:08 -0500)
Once ChannelManager supports payment retries, it will make more sense for its
current send_payment method to be named send_payment_with_route because
retrying should be the default. Here we get a head start on this by making the
rename in outbound_payment, but not changing the public interface yet.

lightning/src/ln/channelmanager.rs
lightning/src/ln/outbound_payment.rs

index 61cc2af81c7d8f50447f8ee02471df230dabe4a6..2c7a383c52b041ecdc42ba8b530a411c884bdd65 100644 (file)
@@ -2370,7 +2370,7 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
        pub fn send_payment(&self, route: &Route, payment_hash: PaymentHash, payment_secret: &Option<PaymentSecret>, payment_id: PaymentId) -> Result<(), PaymentSendFailure> {
                let best_block_height = self.best_block.read().unwrap().height();
                self.pending_outbound_payments
-                       .send_payment(route, payment_hash, payment_secret, payment_id, &self.keys_manager, best_block_height,
+                       .send_payment_with_route(route, payment_hash, payment_secret, payment_id, &self.keys_manager, best_block_height,
                                |path, payment_params, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv|
                                self.send_payment_along_path(path, payment_params, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv))
        }
@@ -2402,7 +2402,7 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
        /// [`abandon_payment`]: [`ChannelManager::abandon_payment`]
        pub fn retry_payment(&self, route: &Route, payment_id: PaymentId) -> Result<(), PaymentSendFailure> {
                let best_block_height = self.best_block.read().unwrap().height();
-               self.pending_outbound_payments.retry_payment(route, payment_id, &self.keys_manager, best_block_height,
+               self.pending_outbound_payments.retry_payment_with_route(route, payment_id, &self.keys_manager, best_block_height,
                        |path, payment_params, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv|
                        self.send_payment_along_path(path, payment_params, payment_hash, payment_secret, total_value, cur_height, payment_id, keysend_preimage, session_priv))
        }
index 60c111b276a0c551df15298b047156a48a4524e3..95ad59e634faf41bf461855255b10ec5574cdcb8 100644 (file)
@@ -271,7 +271,7 @@ impl OutboundPayments {
                }
        }
 
-       pub(super) fn send_payment<K: Deref, F>(
+       pub(super) fn send_payment_with_route<K: Deref, F>(
                &self, route: &Route, payment_hash: PaymentHash, payment_secret: &Option<PaymentSecret>,
                payment_id: PaymentId, keys_manager: &K, best_block_height: u32, send_payment_along_path: F
        ) -> Result<(), PaymentSendFailure>
@@ -306,7 +306,7 @@ impl OutboundPayments {
                }
        }
 
-       pub(super) fn retry_payment<K: Deref, F>(
+       pub(super) fn retry_payment_with_route<K: Deref, F>(
                &self, route: &Route, payment_id: PaymentId, keys_manager: &K, best_block_height: u32,
                send_payment_along_path: F
        ) -> Result<(), PaymentSendFailure>