@@ -1204,36 +1204,26 @@ impl ChannelDetails {
1204
1204
}
1205
1205
}
1206
1206
1207
- /// We store payments that are pending resolution as `PendingOutboundPayment` in `ChannelManager`,
1208
- /// and they can take on either one of the following states as defined in this enum.
1207
+ /// Used to express the status of payments that are currently pending resolution.
1209
1208
#[ derive( Debug , PartialEq ) ]
1210
- pub enum PendingPaymentStatus {
1209
+ pub enum PendingPaymentDetails {
1211
1210
/// When a payment is still being sent and awaiting successful delivery.
1212
- Retryable ,
1211
+ Retryable {
1212
+ /// Total amount (in msat) across all paths for this payment, not just the amount currently
1213
+ /// inflight.
1214
+ total_msat : u64
1215
+ } ,
1213
1216
/// When a pending payment is fulfilled, we continue tracking it until all pending HTLCs have
1214
- /// been resolved. This ensures we don't look up pending payments in ChannelMonitors on restart
1215
- /// and add a pending payment that was already fulfilled .
1217
+ /// been resolved. These payments will only cease being tracked upon receiving or handling
1218
+ /// [`Event::PaymentSent`] .
1216
1219
Fulfilled ,
1217
- /// When a payer gives up trying to retry a payment, they inform us, letting us generate a
1218
- /// `PaymentFailed` event when all HTLCs have irrevocably failed. This avoids a number of race
1219
- /// conditions in MPP-aware payment retriers (1), where the possibility of multiple
1220
- /// `PaymentPathFailed` events with `all_paths_failed` can be pending at once, confusing a
1221
- /// downstream event handler as to when a payment has actually failed.
1222
- ///
1223
- /// (1) https://github.com/lightningdevkit/rust-lightning/issues/1164
1220
+ /// After a payment is explicitly abandoned by calling [`ChannelManager::abandon_payment`], they
1221
+ /// are marked as abandoned until an [`Event::PaymentFailed`] event is generated. A payment
1222
+ /// could also be marked as abandoned if pathfinding fails repeatedly and we will no longer
1223
+ /// retry sending.
1224
1224
Abandoned ,
1225
1225
}
1226
1226
1227
- /// Details of a pending payment, as returned by [`ChannelManager::list_pending_payments`].
1228
- pub struct PendingPaymentDetails {
1229
- /// Current status of a payment that is pending resolution.
1230
- pub status : PendingPaymentStatus ,
1231
- /// Total amount (in msat) across all paths for this payment, not just the amount currently
1232
- /// inflight. This field is `None` if the payment's status is either
1233
- /// `PendingPaymentStatus::Fulfilled` or `PendingPaymentPaymentStatus::Abandoned`.
1234
- pub total_msat : Option < u64 > ,
1235
- }
1236
-
1237
1227
/// If a payment fails to send, it can be in one of several states. This enum is returned as the
1238
1228
/// Err() type describing which state the payment is in, see the description of individual enum
1239
1229
/// states for more.
@@ -1806,13 +1796,13 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
1806
1796
self . pending_outbound_payments . lock ( ) . unwrap ( ) . iter ( )
1807
1797
. filter_map ( |( _, pending_outbound_payment) | match pending_outbound_payment {
1808
1798
PendingOutboundPayment :: Retryable { total_msat, .. } => {
1809
- Some ( PendingPaymentDetails { status : PendingPaymentStatus :: Retryable , total_msat : Some ( * total_msat) } )
1799
+ Some ( PendingPaymentDetails :: Retryable { total_msat : * total_msat } )
1810
1800
} ,
1811
1801
PendingOutboundPayment :: Abandoned { .. } => {
1812
- Some ( PendingPaymentDetails { status : PendingPaymentStatus :: Abandoned , total_msat : None } )
1802
+ Some ( PendingPaymentDetails :: Abandoned )
1813
1803
} ,
1814
1804
PendingOutboundPayment :: Fulfilled { .. } => {
1815
- Some ( PendingPaymentDetails { status : PendingPaymentStatus :: Fulfilled , total_msat : None } )
1805
+ Some ( PendingPaymentDetails :: Fulfilled )
1816
1806
} ,
1817
1807
PendingOutboundPayment :: Legacy { .. } => None
1818
1808
} )
0 commit comments