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§
Sourcefn 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.
If the provided OffersContext is Some, then the message was sent to a blinded path that we
created and was authenticated as such by the OnionMessenger. There is one exception to
this: OffersContext::InvoiceRequest.
In order to support offers created prior to LDK 0.2, OffersContext::InvoiceRequests are
not authenticated by the OnionMessenger. It is the responsibility of message handling code
to authenticate the provided OffersContext in this case.
The returned OffersMessage, if any, is enqueued to be sent by OnionMessenger.
Provided Methods§
Sourcefn release_pending_messages(
&self,
) -> Vec<(OffersMessage, MessageSendInstructions)>
fn release_pending_messages( &self, ) -> Vec<(OffersMessage, MessageSendInstructions)>
Releases any OffersMessages 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.