@@ -1188,16 +1188,25 @@ impl ChannelDetails {
11881188#[ derive( Clone , Debug ) ]
11891189pub enum PaymentSendFailure {
11901190 /// 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.
11931198 ParameterError ( APIError ) ,
11941199 /// 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) .
11981203 ///
11991204 /// The results here are ordered the same as the paths in the route object which was passed to
12001205 /// 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.
12011210 PathParameterError ( Vec < Result < ( ) , APIError > > ) ,
12021211 /// All paths which were attempted failed to send, with no channel state change taking place.
12031212 /// You can freely resend the payment in full (though you probably want to do so over different
@@ -1207,6 +1216,12 @@ pub enum PaymentSendFailure {
12071216 /// [`ChannelManager::abandon_payment`] and [`ChannelManager::retry_payment`] will *not* work
12081217 /// for this payment.
12091218 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 ,
12101225 /// Some paths which were attempted failed to send, though possibly not all. At least some
12111226 /// paths have irrevocably committed to the HTLC and retrying the payment in full would result
12121227 /// in over-/re-payment.
@@ -2611,9 +2626,7 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
26112626
26122627 let mut pending_outbounds = self . pending_outbound_payments . lock ( ) . unwrap ( ) ;
26132628 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 ) ,
26172630 hash_map:: Entry :: Vacant ( entry) => {
26182631 let payment = entry. insert ( PendingOutboundPayment :: Retryable {
26192632 session_privs : HashSet :: new ( ) ,
0 commit comments