Skip to content

Commit 477a902

Browse files
f move method
1 parent d4aff0e commit 477a902

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

lightning/src/onion_message/messenger.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -854,27 +854,6 @@ where
854854
)
855855
}
856856

857-
/// Forwards an [`OnionMessage`] to `peer_node_id`. Useful if we initialized
858-
/// the [`OnionMessenger`] with [`Self::new_with_offline_peer_interception`]
859-
/// and want to forward a previously intercepted onion message to a peer that
860-
/// has just come online.
861-
pub fn forward_onion_message(
862-
&self, message: OnionMessage, peer_node_id: &PublicKey
863-
) -> Result<(), SendError> {
864-
let mut message_recipients = self.message_recipients.lock().unwrap();
865-
if outbound_buffer_full(&peer_node_id, &message_recipients) {
866-
return Err(SendError::BufferFull);
867-
}
868-
869-
match message_recipients.entry(*peer_node_id) {
870-
hash_map::Entry::Occupied(mut e) if e.get().is_connected() => {
871-
e.get_mut().enqueue_message(message);
872-
Ok(())
873-
},
874-
_ => Err(SendError::InvalidFirstHop(*peer_node_id))
875-
}
876-
}
877-
878857
fn find_path_and_enqueue_onion_message<T: OnionMessageContents>(
879858
&self, contents: T, destination: Destination, reply_path: Option<BlindedPath>,
880859
log_suffix: fmt::Arguments
@@ -964,6 +943,27 @@ where
964943
}
965944
}
966945

946+
/// Forwards an [`OnionMessage`] to `peer_node_id`. Useful if we initialized
947+
/// the [`OnionMessenger`] with [`Self::new_with_offline_peer_interception`]
948+
/// and want to forward a previously intercepted onion message to a peer that
949+
/// has just come online.
950+
pub fn forward_onion_message(
951+
&self, message: OnionMessage, peer_node_id: &PublicKey
952+
) -> Result<(), SendError> {
953+
let mut message_recipients = self.message_recipients.lock().unwrap();
954+
if outbound_buffer_full(&peer_node_id, &message_recipients) {
955+
return Err(SendError::BufferFull);
956+
}
957+
958+
match message_recipients.entry(*peer_node_id) {
959+
hash_map::Entry::Occupied(mut e) if e.get().is_connected() => {
960+
e.get_mut().enqueue_message(message);
961+
Ok(())
962+
},
963+
_ => Err(SendError::InvalidFirstHop(*peer_node_id))
964+
}
965+
}
966+
967967
#[cfg(any(test, feature = "_test_utils"))]
968968
pub fn send_onion_message_using_path<T: OnionMessageContents>(
969969
&self, path: OnionMessagePath, contents: T, reply_path: Option<BlindedPath>

0 commit comments

Comments
 (0)