pub trait OffersMessageHandler {
// Required method
fn handle_message(&self, message: OffersMessage) -> Option<OffersMessage>;
// Provided method
fn release_pending_messages(
&self,
) -> Vec<PendingOnionMessage<OffersMessage>> { ... }
}
Expand description
A handler for an OnionMessage
containing a BOLT 12 Offers message as its payload.
Required Methods§
fn handle_message(&self, message: OffersMessage) -> Option<OffersMessage>
fn handle_message(&self, message: OffersMessage) -> Option<OffersMessage>
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
.
Provided Methods§
fn release_pending_messages(&self) -> Vec<PendingOnionMessage<OffersMessage>>
fn release_pending_messages(&self) -> Vec<PendingOnionMessage<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
.