From a6cd661712ed05421eef3af9f0088d73b7f50ceb Mon Sep 17 00:00:00 2001 From: Jeffrey Czyz Date: Tue, 12 Sep 2023 16:14:16 -0500 Subject: [PATCH] Update OnionMessenger docs for Offers --- lightning/src/onion_message/messenger.rs | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/lightning/src/onion_message/messenger.rs b/lightning/src/onion_message/messenger.rs index 1a0145441..27a0b0cd1 100644 --- a/lightning/src/onion_message/messenger.rs +++ b/lightning/src/onion_message/messenger.rs @@ -35,9 +35,21 @@ use crate::io; use crate::sync::{Arc, Mutex}; use crate::prelude::*; -/// A sender, receiver and forwarder of onion messages. In upcoming releases, this object will be -/// used to retrieve invoices and fulfill invoice requests from [offers]. Currently, only sending -/// and receiving custom onion messages is supported. +/// A sender, receiver and forwarder of [`OnionMessage`]s. +/// +/// # Handling Messages +/// +/// `OnionMessenger` implements [`OnionMessageHandler`], making it responsible for either forwarding +/// messages to peers or delegating to the appropriate handler for the message type. Currently, the +/// available handlers are: +/// * [`OffersMessageHandler`], for responding to [`InvoiceRequest`]s and paying [`Bolt12Invoice`]s +/// * [`CustomOnionMessageHandler`], for handling user-defined message types +/// +/// # Sending Messages +/// +/// [`OnionMessage`]s are sent initially using [`OnionMessenger::send_onion_message`]. When handling +/// a message, the matched handler may return a response message which `OnionMessenger` will send +/// on its behalf. /// /// # Example /// @@ -121,8 +133,9 @@ use crate::prelude::*; /// onion_messenger.send_onion_message(path, message, reply_path); /// ``` /// -/// [offers]: -/// [`OnionMessenger`]: crate::onion_message::OnionMessenger +/// [`OnionMessage`]: crate::ln::msgs::OnionMessage +/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest +/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice pub struct OnionMessenger where ES::Target: EntropySource, -- 2.39.5