+ /// Indicates that a peer connection with a node is needed in order to send an [`OnionMessage`].
+ ///
+ /// Typically, this happens when a [`MessageRouter`] is unable to find a complete path to a
+ /// [`Destination`]. Once a connection is established, any messages buffered by an
+ /// [`OnionMessageHandler`] may be sent.
+ ///
+ /// This event will not be generated for onion message forwards; only for sends including
+ /// replies. Handlers should connect to the node otherwise any buffered messages may be lost.
+ ///
+ /// [`OnionMessage`]: msgs::OnionMessage
+ /// [`MessageRouter`]: crate::onion_message::MessageRouter
+ /// [`Destination`]: crate::onion_message::Destination
+ /// [`OnionMessageHandler`]: crate::ln::msgs::OnionMessageHandler
+ ConnectionNeeded {
+ /// The node id for the node needing a connection.
+ node_id: PublicKey,
+ /// Sockets for connecting to the node.
+ addresses: Vec<msgs::SocketAddress>,
+ },