Skip to content

Commit

Permalink
Let onion to string fn private
Browse files Browse the repository at this point in the history
  • Loading branch information
yanganto committed Oct 19, 2023
1 parent 7d9eb3f commit e95b762
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lightning/src/ln/msgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -986,12 +986,14 @@ pub fn parse_onion_address(host: &str, port: u16) -> Result<SocketAddress, Socke
}

/// [`SocketAddress::OnionV2`] to debug represent
pub fn to_onion_v2_string(bytes: &[u8; 12]) -> String {
#[inline]
fn to_onion_v2_string(bytes: &[u8; 12]) -> String {
format!("OnionV2({:?})", bytes)
}

/// [`SocketAddress::OnionV3`] to onion address string
pub fn to_onion_v3_string(key: &[u8; 32], checksum: &u16, version: &u8, port: &u16) -> String{
#[inline]
fn to_onion_v3_string(key: &[u8; 32], checksum: &u16, version: &u8, port: &u16) -> String{
let [first_checksum_flag, second_checksum_flag] = checksum.to_be_bytes();
let mut addr = vec![*version, first_checksum_flag, second_checksum_flag];
addr.extend_from_slice(key);
Expand Down

0 comments on commit e95b762

Please sign in to comment.