Remove OnionMessageProvider
[rust-lightning] / lightning / src / events / mod.rs
index bb98e271597309d057ca4712b394e302b35cddc3..ca55fde31c5bee711e75693d07cc8dc8b82b52b1 100644 (file)
@@ -199,6 +199,9 @@ pub enum ClosureReason {
        /// The counterparty requested a cooperative close of a channel that had not been funded yet.
        /// The channel has been immediately closed.
        CounterpartyCoopClosedUnfundedChannel,
+       /// Another channel in the same funding batch closed before the funding transaction
+       /// was ready to be broadcast.
+       FundingBatchClosure,
 }
 
 impl core::fmt::Display for ClosureReason {
@@ -219,6 +222,7 @@ impl core::fmt::Display for ClosureReason {
                        ClosureReason::DisconnectedPeer => f.write_str("the peer disconnected prior to the channel being funded"),
                        ClosureReason::OutdatedChannelManager => f.write_str("the ChannelManager read from disk was stale compared to ChannelMonitor(s)"),
                        ClosureReason::CounterpartyCoopClosedUnfundedChannel => f.write_str("the peer requested the unfunded channel be closed"),
+                       ClosureReason::FundingBatchClosure => f.write_str("another channel in the same funding batch closed"),
                }
        }
 }
@@ -233,6 +237,7 @@ impl_writeable_tlv_based_enum_upgradable!(ClosureReason,
        (10, DisconnectedPeer) => {},
        (12, OutdatedChannelManager) => {},
        (13, CounterpartyCoopClosedUnfundedChannel) => {},
+       (15, FundingBatchClosure) => {}
 );
 
 /// Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`].
@@ -512,6 +517,7 @@ pub enum Event {
        /// or was explicitly abandoned by [`ChannelManager::abandon_payment`].
        ///
        /// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
+       #[cfg(invreqfailed)]
        InvoiceRequestFailed {
                /// The `payment_id` to have been associated with payment for the requested invoice.
                payment_id: PaymentId,
@@ -844,6 +850,8 @@ pub enum Event {
        },
        /// Used to indicate to the user that they can abandon the funding transaction and recycle the
        /// inputs for another purpose.
+       ///
+       /// This event is not guaranteed to be generated for channels that are closed due to a restart.
        DiscardFunding {
                /// The channel_id of the channel which has been closed.
                channel_id: ChannelId,
@@ -1156,6 +1164,7 @@ impl Writeable for Event {
                                        (8, funding_txo, required),
                                });
                        },
+                       #[cfg(invreqfailed)]
                        &Event::InvoiceRequestFailed { ref payment_id } => {
                                33u8.write(writer)?;
                                write_tlv_fields!(writer, {
@@ -1549,6 +1558,7 @@ impl MaybeReadable for Event {
                                };
                                f()
                        },
+                       #[cfg(invreqfailed)]
                        33u8 => {
                                let f = || {
                                        _init_and_read_len_prefixed_tlv_fields!(reader, {
@@ -1836,12 +1846,6 @@ pub trait MessageSendEventsProvider {
        fn get_and_clear_pending_msg_events(&self) -> Vec<MessageSendEvent>;
 }
 
-/// A trait indicating an object may generate onion messages to send
-pub trait OnionMessageProvider {
-       /// Gets the next pending onion message for the peer with the given node id.
-       fn next_onion_message_for_peer(&self, peer_node_id: PublicKey) -> Option<msgs::OnionMessage>;
-}
-
 /// A trait indicating an object may generate events.
 ///
 /// Events are processed by passing an [`EventHandler`] to [`process_pending_events`].