use crate::offers::invoice::Bolt12Invoice;
use crate::offers::parse::Bolt12ParseError;
use crate::onion_message::OnionMessageContents;
+use crate::onion_message::messenger::PendingOnionMessage;
use crate::util::logger::Logger;
use crate::util::ser::{Readable, ReadableArgs, Writeable, Writer};
pub trait OffersMessageHandler {
/// Handles the given message by either responding with an [`Bolt12Invoice`], sending a payment,
/// or replying with an error.
+ ///
+ /// The returned [`OffersMessage`], if any, is enqueued to be sent by [`OnionMessenger`].
+ ///
+ /// [`OnionMessenger`]: crate::onion_message::OnionMessenger
fn handle_message(&self, message: OffersMessage) -> Option<OffersMessage>;
+
+ /// Releases any [`OffersMessage`]s that need to be sent.
+ ///
+ /// Typically, this is used for messages initiating a payment flow rather than in response to
+ /// another message. The latter should use the return value of [`Self::handle_message`].
+ #[cfg(not(c_bindings))]
+ fn release_pending_messages(&self) -> Vec<PendingOnionMessage<OffersMessage>> { vec![] }
+
+ /// Releases any [`OffersMessage`]s that need to be sent.
+ ///
+ /// Typically, this is used for messages initiating a payment flow rather than in response to
+ /// another message. The latter should use the return value of [`Self::handle_message`].
+ #[cfg(c_bindings)]
+ fn release_pending_messages(&self) -> Vec<(OffersMessage, crate::onion_message::Destination, Option<crate::blinded_path::BlindedPath>)> { vec![] }
}
/// Possible BOLT 12 Offers messages sent and received via an [`OnionMessage`].