Skip to content

Commit 66e9288

Browse files
committed
Rename PaymentSendFailure::AllFailedRetrySafe ...ResendSafe
It was pointed out that its quite confusing that `AllFailedRetrySafe` does not allow you to call `retry_payment`, though the documentation on it does specify this. Instead, we simply rename it to `AllFailedResendSafe` to indicate that the action that is safe to take is *resending*, not *retrying*.
1 parent 0df712a commit 66e9288

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,9 +1203,10 @@ pub enum PaymentSendFailure {
12031203
/// You can freely retry the payment in full (though you probably want to do so over different
12041204
/// paths than the ones selected).
12051205
///
1206-
/// [`ChannelManager::abandon_payment`] does *not* need to be called for this payment and
1207-
/// [`ChannelManager::retry_payment`] will *not* work for this payment.
1208-
AllFailedRetrySafe(Vec<APIError>),
1206+
/// Because the payment failed outright, no payment tracking is done, you do not need to call
1207+
/// [`ChannelManager::abandon_payment`] and [`ChannelManager::retry_payment`] will *not* work
1208+
/// for this payment.
1209+
AllFailedResendSafe(Vec<APIError>),
12091210
/// Some paths which were attempted failed to send, though possibly not all. At least some
12101211
/// paths have irrevocably committed to the HTLC and retrying the payment in full would result
12111212
/// in over-/re-payment.
@@ -2707,7 +2708,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
27072708
// `pending_outbound_payments` map, as the user isn't expected to `abandon_payment`.
27082709
let removed = self.pending_outbound_payments.lock().unwrap().remove(&payment_id).is_some();
27092710
debug_assert!(removed, "We should always have a pending payment to remove here");
2710-
Err(PaymentSendFailure::AllFailedRetrySafe(results.drain(..).map(|r| r.unwrap_err()).collect()))
2711+
Err(PaymentSendFailure::AllFailedResendSafe(results.drain(..).map(|r| r.unwrap_err()).collect()))
27112712
} else {
27122713
Ok(())
27132714
}

lightning/src/ln/functional_test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ macro_rules! get_local_commitment_txn {
587587
macro_rules! unwrap_send_err {
588588
($res: expr, $all_failed: expr, $type: pat, $check: expr) => {
589589
match &$res {
590-
&Err(PaymentSendFailure::AllFailedRetrySafe(ref fails)) if $all_failed => {
590+
&Err(PaymentSendFailure::AllFailedResendSafe(ref fails)) if $all_failed => {
591591
assert_eq!(fails.len(), 1);
592592
match fails[0] {
593593
$type => { $check },

lightning/src/ln/functional_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1332,7 +1332,7 @@ fn test_basic_channel_reserve() {
13321332
let (route, our_payment_hash, _, our_payment_secret) = get_route_and_payment_hash!(nodes[0], nodes[1], max_can_send + 1);
13331333
let err = nodes[0].node.send_payment(&route, our_payment_hash, &Some(our_payment_secret), PaymentId(our_payment_hash.0)).err().unwrap();
13341334
match err {
1335-
PaymentSendFailure::AllFailedRetrySafe(ref fails) => {
1335+
PaymentSendFailure::AllFailedResendSafe(ref fails) => {
13361336
match &fails[0] {
13371337
&APIError::ChannelUnavailable{ref err} =>
13381338
assert!(regex::Regex::new(r"Cannot send value that would put our balance under counterparty-announced channel reserve value \(\d+\)").unwrap().is_match(err)),

0 commit comments

Comments
 (0)