Skip to content

Commit a47ccaa

Browse files
committed
reexport packet::Packet publically
1 parent c7ad6b5 commit a47ccaa

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lightning/src/onion_message/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ mod functional_tests;
2929
// Re-export structs so they can be imported with just the `onion_message::` module prefix.
3030
pub use self::messenger::{CustomOnionMessageContents, CustomOnionMessageHandler, DefaultMessageRouter, Destination, MessageRouter, OnionMessageContents, OnionMessagePath, OnionMessenger, SendError, SimpleArcOnionMessenger, SimpleRefOnionMessenger};
3131
pub use self::offers::{OffersMessage, OffersMessageHandler};
32-
pub(crate) use self::packet::{ControlTlvs, Packet};
32+
pub use self::packet::Packet;
33+
pub(crate) use self::packet::ControlTlvs;

lightning/src/onion_message/packet.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,21 @@ use crate::prelude::*;
3232
pub(super) const SMALL_PACKET_HOP_DATA_LEN: usize = 1300;
3333
pub(super) const BIG_PACKET_HOP_DATA_LEN: usize = 32768;
3434

35+
/// Packet of hop data for next peer
3536
#[derive(Clone, Debug, PartialEq, Eq)]
3637
pub struct Packet {
38+
/// Bolt 04 version number
3739
pub version: u8,
40+
/// The PublicKey used during shared secret generation
3841
pub public_key: PublicKey,
42+
/// 1300 bytes payload for the next hop
43+
//
3944
// Unlike the onion packets used for payments, onion message packets can have payloads greater
4045
// than 1300 bytes.
4146
// TODO: if 1300 ends up being the most common size, optimize this to be:
4247
// enum { ThirteenHundred([u8; 1300]), VarLen(Vec<u8>) }
4348
pub hop_data: Vec<u8>,
49+
/// HMAC to verify the integrity of hop_data
4450
pub hmac: [u8; 32],
4551
}
4652

0 commit comments

Comments
 (0)