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