Skip to content

Commit

Permalink
Rename send_payment and retry_payment for retries
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
valentinewallace committed Dec 19, 2022
1 parent 8ab6c0a commit 77e2014
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lightning/src/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down Expand Up @@ -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))
}
Expand Down
4 changes: 2 additions & 2 deletions lightning/src/ln/outbound_payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit 77e2014

Please sign in to comment.