X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fmsgs.rs;h=d43ad6d0aebc2fd372c5c7837349a9beac0ebedf;hb=2e33acbd9c5ebd605829859a982822df6e0f1723;hp=c9fec287357f322fed6c941c942f0e788fc02761;hpb=31aa48304d7181fb43c3e563ec192804a04a5b68;p=rust-lightning diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs index c9fec287..d43ad6d0 100644 --- a/lightning/src/ln/msgs.rs +++ b/lightning/src/ln/msgs.rs @@ -1674,17 +1674,21 @@ pub use self::fuzzy_internal_msgs::*; #[cfg(not(fuzzing))] pub(crate) use self::fuzzy_internal_msgs::*; +/// BOLT 4 onion packet including hop data for the next peer. #[derive(Clone)] -pub(crate) struct OnionPacket { - pub(crate) version: u8, +pub struct OnionPacket { + /// BOLT 4 version number. + pub version: u8, /// In order to ensure we always return an error on onion decode in compliance with [BOLT /// #4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md), we have to /// deserialize `OnionPacket`s contained in [`UpdateAddHTLC`] messages even if the ephemeral /// public key (here) is bogus, so we hold a [`Result`] instead of a [`PublicKey`] as we'd /// like. - pub(crate) public_key: Result, - pub(crate) hop_data: [u8; 20*65], - pub(crate) hmac: [u8; 32], + pub public_key: Result, + /// 1300 bytes encrypted payload for the next hop. + pub hop_data: [u8; 20*65], + /// HMAC to verify the integrity of hop_data. + pub hmac: [u8; 32], } impl onion_utils::Packet for OnionPacket { @@ -2745,6 +2749,7 @@ mod tests { #[cfg(feature = "std")] use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6, ToSocketAddrs}; + #[cfg(feature = "std")] use crate::ln::msgs::SocketAddressParseError; #[test]