X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=lightning%2Fsrc%2Fonion_message%2Foffers.rs;h=f82afdd618a5bfa78ac02a7e0bfd6476cac4bbdd;hb=c3c105075aeb8128699e043f777b4c89c452e54d;hp=36363c90a629032c6a514347d9d9889e1959ac20;hpb=a799fc9b30f039bb921f0745439a64b4964d75ca;p=rust-lightning diff --git a/lightning/src/onion_message/offers.rs b/lightning/src/onion_message/offers.rs index 36363c90..f82afdd6 100644 --- a/lightning/src/onion_message/offers.rs +++ b/lightning/src/onion_message/offers.rs @@ -26,6 +26,15 @@ const INVOICE_REQUEST_TLV_TYPE: u64 = 64; const INVOICE_TLV_TYPE: u64 = 66; const INVOICE_ERROR_TLV_TYPE: u64 = 68; +/// A handler for an [`OnionMessage`] containing a BOLT 12 Offers message as its payload. +/// +/// [`OnionMessage`]: crate::ln::msgs::OnionMessage +pub trait OffersMessageHandler { + /// Handles the given message by either responding with an [`Invoice`], sending a payment, or + /// replying with an error. + fn handle_message(&self, message: OffersMessage) -> Option; +} + /// Possible BOLT 12 Offers messages sent and received via an [`OnionMessage`]. /// /// [`OnionMessage`]: crate::ln::msgs::OnionMessage @@ -82,7 +91,7 @@ impl Writeable for OffersMessage { } } -impl ReadableArgs<(u64, &L)> for OffersMessage { +impl ReadableArgs<(u64, &L)> for OffersMessage { fn read(r: &mut R, read_args: (u64, &L)) -> Result { let (tlv_type, logger) = read_args; if tlv_type == INVOICE_ERROR_TLV_TYPE {