Skip to content

Commit fae8b63

Browse files
committed
Sort Event variants somewhat more sensibly
1 parent d92d573 commit fae8b63

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

lightning/src/util/events.rs

+41-41
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,47 @@ pub enum Event {
230230
/// [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
231231
fee_paid_msat: Option<u64>,
232232
},
233+
/// Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
234+
/// provide failure information for each MPP part in the payment.
235+
///
236+
/// This event is provided once there are no further pending HTLCs for the payment and the
237+
/// payment is no longer retryable, either due to a several-block timeout or because
238+
/// [`ChannelManager::abandon_payment`] was previously called for the corresponding payment.
239+
///
240+
/// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
241+
PaymentFailed {
242+
/// The id returned by [`ChannelManager::send_payment`] and used with
243+
/// [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
244+
///
245+
/// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
246+
/// [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
247+
/// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
248+
payment_id: PaymentId,
249+
/// The hash that was given to [`ChannelManager::send_payment`].
250+
///
251+
/// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
252+
payment_hash: PaymentHash,
253+
},
254+
/// Indicates that a path for an outbound payment was successful.
255+
///
256+
/// Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
257+
/// [`Event::PaymentSent`] for obtaining the payment preimage.
258+
PaymentPathSuccessful {
259+
/// The id returned by [`ChannelManager::send_payment`] and used with
260+
/// [`ChannelManager::retry_payment`].
261+
///
262+
/// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
263+
/// [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
264+
payment_id: PaymentId,
265+
/// The hash that was given to [`ChannelManager::send_payment`].
266+
///
267+
/// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
268+
payment_hash: Option<PaymentHash>,
269+
/// The payment path that was successful.
270+
///
271+
/// May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
272+
path: Vec<RouteHop>,
273+
},
233274
/// Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped
234275
/// something. You may wish to retry with a different route.
235276
///
@@ -299,27 +340,6 @@ pub enum Event {
299340
#[cfg(test)]
300341
error_data: Option<Vec<u8>>,
301342
},
302-
/// Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
303-
/// provide failure information for each MPP part in the payment.
304-
///
305-
/// This event is provided once there are no further pending HTLCs for the payment and the
306-
/// payment is no longer retryable, either due to a several-block timeout or because
307-
/// [`ChannelManager::abandon_payment`] was previously called for the corresponding payment.
308-
///
309-
/// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
310-
PaymentFailed {
311-
/// The id returned by [`ChannelManager::send_payment`] and used with
312-
/// [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
313-
///
314-
/// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
315-
/// [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
316-
/// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
317-
payment_id: PaymentId,
318-
/// The hash that was given to [`ChannelManager::send_payment`].
319-
///
320-
/// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
321-
payment_hash: PaymentHash,
322-
},
323343
/// Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
324344
/// a time in the future.
325345
///
@@ -387,26 +407,6 @@ pub enum Event {
387407
/// The full transaction received from the user
388408
transaction: Transaction
389409
},
390-
/// Indicates that a path for an outbound payment was successful.
391-
///
392-
/// Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
393-
/// [`Event::PaymentSent`] for obtaining the payment preimage.
394-
PaymentPathSuccessful {
395-
/// The id returned by [`ChannelManager::send_payment`] and used with
396-
/// [`ChannelManager::retry_payment`].
397-
///
398-
/// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
399-
/// [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
400-
payment_id: PaymentId,
401-
/// The hash that was given to [`ChannelManager::send_payment`].
402-
///
403-
/// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
404-
payment_hash: Option<PaymentHash>,
405-
/// The payment path that was successful.
406-
///
407-
/// May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
408-
path: Vec<RouteHop>,
409-
},
410410
/// Indicates a request to open a new channel by a peer.
411411
///
412412
/// To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the

0 commit comments

Comments
 (0)