@@ -551,6 +551,10 @@ pub enum Event {
551
551
/// Note that *all inputs* in the funding transaction must spend SegWit outputs or your
552
552
/// counterparty can steal your funds!
553
553
///
554
+ /// # Failure Behavior and Persistence
555
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
556
+ /// returning `Err(ReplayEvent ())`), but won't be persisted across restarts.
557
+ ///
554
558
/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
555
559
/// [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
556
560
FundingGenerationReady {
@@ -608,6 +612,10 @@ pub enum Event {
608
612
/// # Note
609
613
/// This event used to be called `PaymentReceived` in LDK versions 0.0.112 and earlier.
610
614
///
615
+ /// # Failure Behavior and Persistence
616
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
617
+ /// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
618
+ ///
611
619
/// [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
612
620
/// [`ChannelManager::claim_funds_with_known_custom_tlvs`]: crate::ln::channelmanager::ChannelManager::claim_funds_with_known_custom_tlvs
613
621
/// [`FailureCode::InvalidOnionPayload`]: crate::ln::channelmanager::FailureCode::InvalidOnionPayload
@@ -677,6 +685,10 @@ pub enum Event {
677
685
/// [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentClaimable`] you may get
678
686
/// multiple `PaymentClaimed` events.
679
687
///
688
+ /// # Failure Behavior and Persistence
689
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
690
+ /// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
691
+ ///
680
692
/// [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
681
693
PaymentClaimed {
682
694
/// The node that received the payment.
@@ -716,6 +728,10 @@ pub enum Event {
716
728
/// This event will not be generated for onion message forwards; only for sends including
717
729
/// replies. Handlers should connect to the node otherwise any buffered messages may be lost.
718
730
///
731
+ /// # Failure Behavior and Persistence
732
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
733
+ /// returning `Err(ReplayEvent ())`), but won't be persisted across restarts.
734
+ ///
719
735
/// [`OnionMessage`]: msgs::OnionMessage
720
736
/// [`MessageRouter`]: crate::onion_message::messenger::MessageRouter
721
737
/// [`Destination`]: crate::onion_message::messenger::Destination
@@ -730,6 +746,10 @@ pub enum Event {
730
746
/// or was explicitly abandoned by [`ChannelManager::abandon_payment`]. This may be for an
731
747
/// [`InvoiceRequest`] sent for an [`Offer`] or for a [`Refund`] that hasn't been redeemed.
732
748
///
749
+ /// # Failure Behavior and Persistence
750
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
751
+ /// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
752
+ ///
733
753
/// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
734
754
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
735
755
/// [`Offer`]: crate::offers::offer::Offer
@@ -746,6 +766,10 @@ pub enum Event {
746
766
/// [`ChannelManager::abandon_payment`] to abandon the associated payment. See those docs for
747
767
/// further details.
748
768
///
769
+ /// # Failure Behavior and Persistence
770
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
771
+ /// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
772
+ ///
749
773
/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
750
774
/// [`Refund`]: crate::offers::refund::Refund
751
775
/// [`UserConfig::manually_handle_bolt12_invoices`]: crate::util::config::UserConfig::manually_handle_bolt12_invoices
@@ -768,6 +792,10 @@ pub enum Event {
768
792
///
769
793
/// Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
770
794
/// event. In this situation, you SHOULD treat this payment as having succeeded.
795
+ ///
796
+ /// # Failure Behavior and Persistence
797
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
798
+ /// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
771
799
PaymentSent {
772
800
/// The `payment_id` passed to [`ChannelManager::send_payment`].
773
801
///
@@ -806,6 +834,10 @@ pub enum Event {
806
834
/// received and processed. In this case, the [`Event::PaymentFailed`] event MUST be ignored,
807
835
/// and the payment MUST be treated as having succeeded.
808
836
///
837
+ /// # Failure Behavior and Persistence
838
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
839
+ /// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
840
+ ///
809
841
/// [`Retry`]: crate::ln::channelmanager::Retry
810
842
/// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
811
843
PaymentFailed {
@@ -825,6 +857,10 @@ pub enum Event {
825
857
///
826
858
/// Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
827
859
/// [`Event::PaymentSent`] for obtaining the payment preimage.
860
+ ///
861
+ /// # Failure Behavior and Persistence
862
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
863
+ /// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
828
864
PaymentPathSuccessful {
829
865
/// The `payment_id` passed to [`ChannelManager::send_payment`].
830
866
///
@@ -850,6 +886,10 @@ pub enum Event {
850
886
/// See [`ChannelManager::abandon_payment`] for giving up on this payment before its retries have
851
887
/// been exhausted.
852
888
///
889
+ /// # Failure Behavior and Persistence
890
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
891
+ /// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
892
+ ///
853
893
/// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
854
894
PaymentPathFailed {
855
895
/// The `payment_id` passed to [`ChannelManager::send_payment`].
@@ -889,6 +929,10 @@ pub enum Event {
889
929
error_data : Option < Vec < u8 > > ,
890
930
} ,
891
931
/// Indicates that a probe payment we sent returned successful, i.e., only failed at the destination.
932
+ ///
933
+ /// # Failure Behavior and Persistence
934
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
935
+ /// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
892
936
ProbeSuccessful {
893
937
/// The id returned by [`ChannelManager::send_probe`].
894
938
///
@@ -902,6 +946,10 @@ pub enum Event {
902
946
path : Path ,
903
947
} ,
904
948
/// Indicates that a probe payment we sent failed at an intermediary node on the path.
949
+ ///
950
+ /// # Failure Behavior and Persistence
951
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
952
+ /// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
905
953
ProbeFailed {
906
954
/// The id returned by [`ChannelManager::send_probe`].
907
955
///
@@ -923,6 +971,10 @@ pub enum Event {
923
971
/// Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
924
972
/// a time in the future.
925
973
///
974
+ /// # Failure Behavior and Persistence
975
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
976
+ /// returning `Err(ReplayEvent ())`) and will be regenerated after restarts.
977
+ ///
926
978
/// [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
927
979
PendingHTLCsForwardable {
928
980
/// The minimum amount of time that should be waited prior to calling
@@ -939,6 +991,10 @@ pub enum Event {
939
991
/// [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to this event. See
940
992
/// their docs for more information.
941
993
///
994
+ /// # Failure Behavior and Persistence
995
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
996
+ /// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
997
+ ///
942
998
/// [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
943
999
/// [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs
944
1000
/// [`ChannelManager::forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc
@@ -974,6 +1030,10 @@ pub enum Event {
974
1030
/// You may hand them to the [`OutputSweeper`] utility which will store and (re-)generate spending
975
1031
/// transactions for you.
976
1032
///
1033
+ /// # Failure Behavior and Persistence
1034
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
1035
+ /// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
1036
+ ///
977
1037
/// [`OutputSweeper`]: crate::util::sweep::OutputSweeper
978
1038
SpendableOutputs {
979
1039
/// The outputs which you should store as spendable by you.
@@ -985,6 +1045,10 @@ pub enum Event {
985
1045
} ,
986
1046
/// This event is generated when a payment has been successfully forwarded through us and a
987
1047
/// forwarding fee earned.
1048
+ ///
1049
+ /// # Failure Behavior and Persistence
1050
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
1051
+ /// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
988
1052
PaymentForwarded {
989
1053
/// The channel id of the incoming channel between the previous node and us.
990
1054
///
@@ -1046,6 +1110,10 @@ pub enum Event {
1046
1110
/// This event is emitted when the funding transaction has been signed and is broadcast to the
1047
1111
/// network. For 0conf channels it will be immediately followed by the corresponding
1048
1112
/// [`Event::ChannelReady`] event.
1113
+ ///
1114
+ /// # Failure Behavior and Persistence
1115
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
1116
+ /// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
1049
1117
ChannelPending {
1050
1118
/// The `channel_id` of the channel that is pending confirmation.
1051
1119
channel_id : ChannelId ,
@@ -1075,6 +1143,10 @@ pub enum Event {
1075
1143
/// be used. This event is emitted either when the funding transaction has been confirmed
1076
1144
/// on-chain, or, in case of a 0conf channel, when both parties have confirmed the channel
1077
1145
/// establishment.
1146
+ ///
1147
+ /// # Failure Behavior and Persistence
1148
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
1149
+ /// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
1078
1150
ChannelReady {
1079
1151
/// The `channel_id` of the channel that is ready.
1080
1152
channel_id : ChannelId ,
@@ -1101,6 +1173,10 @@ pub enum Event {
1101
1173
///
1102
1174
/// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
1103
1175
/// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
1176
+ ///
1177
+ /// # Failure Behavior and Persistence
1178
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
1179
+ /// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
1104
1180
ChannelClosed {
1105
1181
/// The `channel_id` of the channel which has been closed. Note that on-chain transactions
1106
1182
/// resolving the channel are likely still awaiting confirmation.
@@ -1135,6 +1211,10 @@ pub enum Event {
1135
1211
/// inputs for another purpose.
1136
1212
///
1137
1213
/// This event is not guaranteed to be generated for channels that are closed due to a restart.
1214
+ ///
1215
+ /// # Failure Behavior and Persistence
1216
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
1217
+ /// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
1138
1218
DiscardFunding {
1139
1219
/// The channel_id of the channel which has been closed.
1140
1220
channel_id : ChannelId ,
@@ -1150,6 +1230,10 @@ pub enum Event {
1150
1230
/// The event is only triggered when a new open channel request is received and the
1151
1231
/// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
1152
1232
///
1233
+ /// # Failure Behavior and Persistence
1234
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
1235
+ /// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
1236
+ ///
1153
1237
/// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
1154
1238
/// [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
1155
1239
/// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
@@ -1206,6 +1290,10 @@ pub enum Event {
1206
1290
///
1207
1291
/// This event, however, does not get generated if an HTLC fails to meet the forwarding
1208
1292
/// requirements (i.e. insufficient fees paid, or a CLTV that is too soon).
1293
+ ///
1294
+ /// # Failure Behavior and Persistence
1295
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
1296
+ /// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
1209
1297
HTLCHandlingFailed {
1210
1298
/// The channel over which the HTLC was received.
1211
1299
prev_channel_id : ChannelId ,
@@ -1219,13 +1307,21 @@ pub enum Event {
1219
1307
/// [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`] config flag is set to true.
1220
1308
/// It is limited to the scope of channels with anchor outputs.
1221
1309
///
1310
+ /// # Failure Behavior and Persistence
1311
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
1312
+ /// returning `Err(ReplayEvent ())`), but will only be regenerated as needed after restarts.
1313
+ ///
1222
1314
/// [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`]: crate::util::config::ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx
1223
1315
BumpTransaction ( BumpTransactionEvent ) ,
1224
1316
/// We received an onion message that is intended to be forwarded to a peer
1225
1317
/// that is currently offline. This event will only be generated if the
1226
1318
/// `OnionMessenger` was initialized with
1227
1319
/// [`OnionMessenger::new_with_offline_peer_interception`], see its docs.
1228
1320
///
1321
+ /// # Failure Behavior and Persistence
1322
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
1323
+ /// returning `Err(ReplayEvent ())`), but won't be persisted across restarts.
1324
+ ///
1229
1325
/// [`OnionMessenger::new_with_offline_peer_interception`]: crate::onion_message::messenger::OnionMessenger::new_with_offline_peer_interception
1230
1326
OnionMessageIntercepted {
1231
1327
/// The node id of the offline peer.
@@ -1239,6 +1335,10 @@ pub enum Event {
1239
1335
/// initialized with
1240
1336
/// [`OnionMessenger::new_with_offline_peer_interception`], see its docs.
1241
1337
///
1338
+ /// # Failure Behavior and Persistence
1339
+ /// This event will eventually be replayed after failures-to-handle (i.e., the event handler
1340
+ /// returning `Err(ReplayEvent ())`), but won't be persisted across restarts.
1341
+ ///
1242
1342
/// [`OnionMessenger::new_with_offline_peer_interception`]: crate::onion_message::messenger::OnionMessenger::new_with_offline_peer_interception
1243
1343
OnionMessagePeerConnected {
1244
1344
/// The node id of the peer we just connected to, who advertises support for
@@ -2335,7 +2435,8 @@ pub trait EventsProvider {
2335
2435
/// An error type that may be returned to LDK in order to safely abort event handling if it can't
2336
2436
/// currently succeed (e.g., due to a persistence failure).
2337
2437
///
2338
- /// LDK will ensure the event is persisted and will eventually be replayed.
2438
+ /// Depending on the type, LDK may ensure the event is persisted and will eventually be replayed.
2439
+ /// Please refer to the documentation of each [`Event`] variant for more details.
2339
2440
#[ derive( Clone , Copy , Debug ) ]
2340
2441
pub struct ReplayEvent ( ) ;
2341
2442
0 commit comments