Skip to content

Commit 683d03c

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.
1 parent 00e06a0 commit 683d03c

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
@@ -1687,6 +1687,9 @@ pub enum Event {
16871687
/// The offline peer should be awoken if possible on receipt of this event, such as via the LSPS5
16881688
/// protocol.
16891689
///
1690+
/// Once they connect, you should handle the generated [`Event::OnionMessagePeerConnected`] and
1691+
/// provide the stored message.
1692+
///
16901693
/// # Failure Behavior and Persistence
16911694
/// This event will eventually be replayed after failures-to-handle (i.e., the event handler
16921695
/// returning `Err(ReplayEvent ())`), but won't be persisted across restarts.
@@ -1698,16 +1701,18 @@ pub enum Event {
16981701
/// The onion message intended to be forwarded to `peer_node_id`.
16991702
message: msgs::OnionMessage,
17001703
},
1701-
/// Indicates that an onion message supporting peer has come online and it may
1702-
/// be time to forward any onion messages that were previously intercepted for
1703-
/// them. This event will only be generated if the `OnionMessenger` was
1704-
/// initialized with
1704+
/// Indicates that an onion message supporting peer has come online and any messages previously
1705+
/// stored for them (from [`Event::OnionMessageIntercepted`]s) should be forwarded to them by
1706+
/// calling [`OnionMessenger::forward_onion_message`].
1707+
///
1708+
/// This event will only be generated if the `OnionMessenger` was initialized with
17051709
/// [`OnionMessenger::new_with_offline_peer_interception`], see its docs.
17061710
///
17071711
/// # Failure Behavior and Persistence
17081712
/// This event will eventually be replayed after failures-to-handle (i.e., the event handler
17091713
/// returning `Err(ReplayEvent ())`), but won't be persisted across restarts.
17101714
///
1715+
/// [`OnionMessenger::forward_onion_message`]: crate::onion_message::messenger::OnionMessenger::forward_onion_message
17111716
/// [`OnionMessenger::new_with_offline_peer_interception`]: crate::onion_message::messenger::OnionMessenger::new_with_offline_peer_interception
17121717
OnionMessagePeerConnected {
17131718
/// The node id of the peer we just connected to, who advertises support for

0 commit comments

Comments
 (0)