@@ -1188,16 +1188,25 @@ impl ChannelDetails {
1188
1188
#[ derive( Clone , Debug ) ]
1189
1189
pub enum PaymentSendFailure {
1190
1190
/// A parameter which was passed to send_payment was invalid, preventing us from attempting to
1191
- /// send the payment at all. No channel state has been changed or messages sent to peers, and
1192
- /// once you've changed the parameter at error, you can freely retry the payment in full.
1191
+ /// send the payment at all.
1192
+ ///
1193
+ /// You can freely resend the payment in full (with the parameter error fixed).
1194
+ ///
1195
+ /// Because the payment failed outright, no payment tracking is done, you do not need to call
1196
+ /// [`ChannelManager::abandon_payment`] and [`ChannelManager::retry_payment`] will *not* work
1197
+ /// for this payment.
1193
1198
ParameterError ( APIError ) ,
1194
1199
/// A parameter in a single path which was passed to send_payment was invalid, preventing us
1195
- /// from attempting to send the payment at all. No channel state has been changed or messages
1196
- /// sent to peers, and once you've changed the parameter at error, you can freely retry the
1197
- /// payment in full.
1200
+ /// from attempting to send the payment at all.
1201
+ ///
1202
+ /// You can freely resend the payment in full (with the parameter error fixed) .
1198
1203
///
1199
1204
/// The results here are ordered the same as the paths in the route object which was passed to
1200
1205
/// send_payment.
1206
+ ///
1207
+ /// Because the payment failed outright, no payment tracking is done, you do not need to call
1208
+ /// [`ChannelManager::abandon_payment`] and [`ChannelManager::retry_payment`] will *not* work
1209
+ /// for this payment.
1201
1210
PathParameterError ( Vec < Result < ( ) , APIError > > ) ,
1202
1211
/// All paths which were attempted failed to send, with no channel state change taking place.
1203
1212
/// You can freely resend the payment in full (though you probably want to do so over different
@@ -1207,6 +1216,12 @@ pub enum PaymentSendFailure {
1207
1216
/// [`ChannelManager::abandon_payment`] and [`ChannelManager::retry_payment`] will *not* work
1208
1217
/// for this payment.
1209
1218
AllFailedResendSafe ( Vec < APIError > ) ,
1219
+ /// Indicates that a payment for the provided [`PaymentId`] is already in-flight and has not
1220
+ /// yet completed (i.e. generated an [`Event::PaymentSent`]) or been abandoned (via
1221
+ /// [`ChannelManager::abandon_payment`]).
1222
+ ///
1223
+ /// [`Event::PaymentSent`]: events::Event::PaymentSent
1224
+ DuplicatePayment ,
1210
1225
/// Some paths which were attempted failed to send, though possibly not all. At least some
1211
1226
/// paths have irrevocably committed to the HTLC and retrying the payment in full would result
1212
1227
/// in over-/re-payment.
@@ -2611,9 +2626,7 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
2611
2626
2612
2627
let mut pending_outbounds = self . pending_outbound_payments . lock ( ) . unwrap ( ) ;
2613
2628
match pending_outbounds. entry ( payment_id) {
2614
- hash_map:: Entry :: Occupied ( _) => Err ( PaymentSendFailure :: ParameterError ( APIError :: RouteError {
2615
- err : "Payment already in progress"
2616
- } ) ) ,
2629
+ hash_map:: Entry :: Occupied ( _) => Err ( PaymentSendFailure :: DuplicatePayment ) ,
2617
2630
hash_map:: Entry :: Vacant ( entry) => {
2618
2631
let payment = entry. insert ( PendingOutboundPayment :: Retryable {
2619
2632
session_privs : HashSet :: new ( ) ,
0 commit comments