X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fmsgs.rs;h=a68ac35218594689cd36402b7b4c05df3fa7321c;hb=dd15ab03944cfb6e71dd11b806ace1b4fa225bef;hp=c617d97fe52705c8673c6f4a68f331bb8ed644a6;hpb=cd16cdd806ca3806e4c42868d5ef0b53caaad2e5;p=rust-lightning diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs index c617d97f..a68ac352 100644 --- a/lightning/src/ln/msgs.rs +++ b/lightning/src/ln/msgs.rs @@ -39,10 +39,12 @@ use crate::onion_message; use crate::sign::{NodeSigner, Recipient}; use crate::prelude::*; +#[cfg(feature = "std")] use core::convert::TryFrom; use core::fmt; use core::fmt::Debug; use core::ops::Deref; +#[cfg(feature = "std")] use core::str::FromStr; use crate::io::{self, Cursor, Read}; use crate::io_extras::read_to_end; @@ -631,7 +633,8 @@ pub struct UpdateAddHTLC { pub struct OnionMessage { /// Used in decrypting the onion packet's payload. pub blinding_point: PublicKey, - pub(crate) onion_routing_packet: onion_message::Packet, + /// The full onion packet including hop data, pubkey, and hmac + pub onion_routing_packet: onion_message::Packet, } /// An [`update_fulfill_htlc`] message to be sent to or received from a peer. @@ -955,7 +958,10 @@ impl From for SocketAddress { } } -fn parse_onion_address(host: &str, port: u16) -> Result { +/// Parses an OnionV3 host and port into a [`SocketAddress::OnionV3`]. +/// +/// The host part must end with ".onion". +pub fn parse_onion_address(host: &str, port: u16) -> Result { if host.ends_with(".onion") { let domain = &host[..host.len() - ".onion".len()]; if domain.len() != 56 {