Skip to content

Commit 79a8da8

Browse files
committed
Add note in OnionMessageIntercepted to handle the connected event
Users implementing the "onion message mailbox" feature and handling `OnionMessageIntercepted` events need to also handle `Event::OnionMessagePeerConnected` events. Here we update the event docs for both to add additional references and be more explicit about what implementors need to do. Backport of ea6a9ae
1 parent 29357f1 commit 79a8da8

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lightning/src/events/mod.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,6 +1690,9 @@ pub enum Event {
16901690
/// The offline peer should be awoken if possible on receipt of this event, such as via the LSPS5
16911691
/// protocol.
16921692
///
1693+
/// Once they connect, you should handle the generated [`Event::OnionMessagePeerConnected`] and
1694+
/// provide the stored message.
1695+
///
16931696
/// # Failure Behavior and Persistence
16941697
/// This event will eventually be replayed after failures-to-handle (i.e., the event handler
16951698
/// returning `Err(ReplayEvent ())`), but won't be persisted across restarts.
@@ -1701,16 +1704,18 @@ pub enum Event {
17011704
/// The onion message intended to be forwarded to `peer_node_id`.
17021705
message: msgs::OnionMessage,
17031706
},
1704-
/// Indicates that an onion message supporting peer has come online and it may
1705-
/// be time to forward any onion messages that were previously intercepted for
1706-
/// them. This event will only be generated if the `OnionMessenger` was
1707-
/// initialized with
1707+
/// Indicates that an onion message supporting peer has come online and any messages previously
1708+
/// stored for them (from [`Event::OnionMessageIntercepted`]s) should be forwarded to them by
1709+
/// calling [`OnionMessenger::forward_onion_message`].
1710+
///
1711+
/// This event will only be generated if the `OnionMessenger` was initialized with
17081712
/// [`OnionMessenger::new_with_offline_peer_interception`], see its docs.
17091713
///
17101714
/// # Failure Behavior and Persistence
17111715
/// This event will eventually be replayed after failures-to-handle (i.e., the event handler
17121716
/// returning `Err(ReplayEvent ())`), but won't be persisted across restarts.
17131717
///
1718+
/// [`OnionMessenger::forward_onion_message`]: crate::onion_message::messenger::OnionMessenger::forward_onion_message
17141719
/// [`OnionMessenger::new_with_offline_peer_interception`]: crate::onion_message::messenger::OnionMessenger::new_with_offline_peer_interception
17151720
OnionMessagePeerConnected {
17161721
/// The node id of the peer we just connected to, who advertises support for

0 commit comments

Comments
 (0)